Xtify +工作灯6.1集成的Andr​​oid环境 [英] Xtify + Worklight 6.1 integration in android environment

查看:201
本文介绍了Xtify +工作灯6.1集成的Andr​​oid环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们一直在努力工作灯和xtify之间的集成推送通知。我们使用的版本为2.3.2 SDK xtify因为最新版本(2.4.2)所作的应用程序失败,因为一类未发现异常。

We have been working on the integration between worklight and xtify for push notifications. We are using version 2.3.2 for xtify sdk since latest version (2.4.2) made the app failed because a class not found exception.

使用xtify的逻辑已经被添加到所述WL混合应用程序的本机code如下:

The logic for using xtify has been added to the native code of the WL hybrid application as follows:

public class XtifyWL extends WLDroidGap {
    public static final String XTIFY_APP_KEY = "xxxxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxx";
    public static final String PROJECT_NUM = "xxxxxxxxxxxx"; // This is the Google Project Number


    @Override
    protected void onStart() {
        // TODO Auto-generated method stub
        super.onStart();
        XtifySDK.start(getApplicationContext(), XTIFY_APP_KEY, PROJECT_NUM);
    }

我们收到的推送通知,但他们被复制。我们收到了工作灯一个通知,当您尝试打开它失败,一个多为本地应用程序多数民众赞成正常工作。

We are receiving the push notifications, but they are duplicated. We received one notification for worklight that fails when you try to open it, and one more for the native application thats works correctly.

我们如何解决这个问题?

How can we fix it?

关于使用SDK中的问题2.4.2.2

About the issue with the SDK 2.4.2.2

使用SDK 2.4.2.2唯一的例外是:

The exception with SDK 2.4.2.2 is:

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to get provider com.xtify.sdk.db.Provider: java.lang.ClassNotFoundException: com.xtify.sdk.db.Provider
at android.app.ActivityThread.installProvider(ActivityThread.java:4609)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4236)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4178)
at android.app.ActivityThread.access$1400(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.xtify.sdk.db.Provider
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.ActivityThread.installProvider(ActivityThread.java:4594)
... 12 more

在这里我们看到,类在AndroidManifest.xml中唯一的地方

The only place where we see that class is in the AndroidManifest.xml

<provider android:name="com.xtify.sdk.db.Provider" android:authorities="com.XtifyApp.XTIFY_PROVIDER" android:exported="false" />

如果我们评论说行就失败,下次使用任何一类SDK的。我们已经添加了SDK .jar文件到Android项目的libs文件夹和到Android项目的构建路径。

If we comment that line it fails with the next use of any class of the SDK. We have added the sdk .jar file to the libs folder of the android project and to the build path of the android project.

谢谢,

推荐答案

我们已经发现为什么当我们发送推送通知,我们看到他们重复(在前两名通知图标)。

We have found why when we send a push notification, we see them duplicated (two notifications icons on the top).

这是在AndroidManifest.xml的错误,我们添加了所有Xtify GCM配置,我们也离开了工作灯GCM配置,所以我们在这里注册两个接收器。

It was an error in the AndroidManifest.xml, we added all the Xtify GCM configuration and we also left the worklight GCM configuration so we where registering two receivers.

但我们还是抛出java.lang.ClassNotFoundException的问题,当我们试图用最新的Xtify SDK。 Athough接收至少简单的通知似乎与SDK 2.3.2工作。

But we have still the issue of "java.lang.ClassNotFoundException" when we try to use the latest Xtify SDK. Athough at least receiving simple notifications seems to work with the SDK 2.3.2.

这是正确的Andr​​oidManifest.xml:

This is the correct AndroidManifest.xml:

<?xml version="1.0" encoding="UTF-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.XtifyApp" android:versionCode="1" android:versionName="1.0">  
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18"/>  
<supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="false"/>  
<uses-permission android:name="android.permission.INTERNET"/>  
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>  
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>  
<!-- Push permissions -->  
<permission android:name="com.XtifyApp.permission.C2D_MESSAGE" android:protectionLevel="signature"/>  
<uses-permission android:name="com.XtifyApp.permission.C2D_MESSAGE"/>  
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>  
<uses-permission android:name="android.permission.WAKE_LOCK"/>  
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>  
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>  
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />


<application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/icon"> 
    <activity android:name=".XtifyApp" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTask"> 
        <intent-filter> 
            <action android:name="android.intent.action.MAIN"/>  
            <category android:name="android.intent.category.LAUNCHER"/> 
        </intent-filter>  
        <intent-filter> 
            <action android:name="com.XtifyApp.XtifyApp.NOTIFICATION"/>  
            <category android:name="android.intent.category.DEFAULT"/> 
        </intent-filter> 
    </activity>  

    <activity android:name="com.worklight.common.WLPreferences" android:label="Worklight Settings"></activity>

    <!-- Start XTIFY -->


    <provider android:name="com.xtify.sdk.db.Provider" android:authorities="com.XtifyApp.XTIFY_PROVIDER" android:exported="false" />

    <receiver android:name=".XtifyNotifier" >
        <intent-filter>
            <action android:name="com.xtify.sdk.NOTIFIER" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.xtify.sdk.c2dm.C2DMBroadcastReceiver" >
        <intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.XtifyApp" />
        </intent-filter>
        <intent-filter android:permission="com.google.android.c2dm.permission.SEND" >
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="com.XtifyApp" />
        </intent-filter>
    </receiver>

    <receiver android:name="com.xtify.sdk.NotifActionReceiver" />
    <receiver android:name="com.xtify.sdk.wi.AlarmReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.TIMEZONE_CHANGED" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.PACKAGE_REPLACED" />
            <data android:scheme="package" />
        </intent-filter>
    </receiver>

    <service android:name="com.xtify.sdk.location.LocationUpdateService" />
    <service android:name="com.xtify.sdk.c2dm.C2DMIntentService" />
    <service android:name="com.xtify.sdk.alarm.MetricsIntentService" />
    <service android:name="com.xtify.sdk.alarm.TagIntentService" />
    <service android:name="com.xtify.sdk.alarm.RegistrationIntentService" />
    <service android:name="com.xtify.sdk.alarm.LocationIntentService" />

    <!-- END XTIFY -->


   <!--  Start Worklight GCM configuration -->
   <!--  
    <service android:name=".GCMIntentService"/>  
    <service android:name=".ForegroundService"/>  

    <receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">             
        <intent-filter> 
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>  
            <category android:name="com.XtifyApp"/> 
        </intent-filter>  
        <intent-filter> 
            <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>  
            <category android:name="com.XtifyApp"/> 
        </intent-filter> 
    </receiver> 
    -->
    <!--  END Worklight GCM configuration -->

</application> 
</manifest>

这篇关于Xtify +工作灯6.1集成的Andr​​oid环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆