1

嗨,我使用此链接,但这不适用于 android 3.0,但适用于 2.0 和 2.2

http://console.xtify.com/implementation-guide-android

错误是:

05-16 16:21:41.132: ERROR/AndroidRuntime(3583): java.lang.RuntimeException: Unable to create service com.xtify.android.sdk.MainService: java.lang.IllegalArgumentException: provider=network
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2034)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.app.ActivityThread.access$2500(ActivityThread.java:123)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1047)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.os.Looper.loop(Looper.java:126)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.app.ActivityThread.main(ActivityThread.java:3997)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at java.lang.reflect.Method.invokeNative(Native Method)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at java.lang.reflect.Method.invoke(Method.java:491)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at dalvik.system.NativeStart.main(Native Method)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583): Caused by: java.lang.IllegalArgumentException: provider=network
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.os.Parcel.readException(Parcel.java:1326)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.os.Parcel.readException(Parcel.java:1276)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:646)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.location.LocationManager._requestLocationUpdates(LocationManager.java:582)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.location.LocationManager.requestLocationUpdates(LocationManager.java:446)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at com.xtify.android.sdk.MainService.g(Unknown Source)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at com.xtify.android.sdk.MainService.onCreate(Unknown Source)
05-16 16:21:41.132: ERROR/AndroidRuntime(3583):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2024)
4

1 回答 1

0

只需使用以下代码:

if (Build.VERSION.SDK_INT >= 8){
    registerForC2dm();
} else {
    // continue to use your pre-C2DM solution here for ex. MQTT library
}
于 2011-08-08T10:38:58.933 回答