你好这是我的代码它只在android 3.0模拟器中给出错误 请帮帮我..
私有PersistentLocationManager persistentLocationManager;
Thread xtifyThread = new Thread(new Runnable() {
@Override
public void run() {
persistentLocationManager = new PersistentLocationManager(
context);
persistentLocationManager
.setNotificationIcon(R.drawable.icon);
persistentLocationManager
.setNotificationDetailsIcon(R.drawable.icon);
boolean trackLocation = persistentLocationManager
.isTrackingLocation();
boolean deliverNotifications = persistentLocationManager
.isDeliveringNotifications();
if (trackLocation || deliverNotifications) {
persistentLocationManager.startService();
}
}
});
xtifyThread.start();
我做了debuging然后我在这一行之后得到了错误:persistentLocationManager.startService();但只有在android 3.0中,除非在所有模拟器中完美地工作
错误日志
05-17 16:38:44.006:ERROR / AndroidRuntime(293):java.lang.RuntimeException:无法创建服务com.xtify.android.sdk.MainService:java.lang.IllegalArgumentException:provider = network 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.app.ActivityThread.handleCreateService(ActivityThread.java:2034) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.app.ActivityThread.access $ 2500(ActivityThread.java:123) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1047) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.os.Handler.dispatchMessage(Handler.java:99) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.os.Looper.loop(Looper.java:126) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.app.ActivityThread.main(ActivityThread.java:3997) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at java.lang.reflect.Method.invokeNative(Native Method) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at java.lang.reflect.Method.invoke(Method.java:491) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:841) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at dalvik.system.NativeStart.main(Native Method) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):引起:java.lang.IllegalArgumentException:provider = network 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.os.Parcel.readException(Parcel.java:1326) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.os.Parcel.readException(Parcel.java:1276) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.location.ILocationManager $ Stub $ Proxy.requestLocationUpdates(ILocationManager.java:646) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.location.LocationManager._requestLocationUpdates(LocationManager.java:582) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.location.LocationManager.requestLocationUpdates(LocationManager.java:446) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at com.xtify.android.sdk.MainService.g(Unknown Source) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):at com.xtify.android.sdk.MainService.onCreate(Unknown Source) 05-17 16:38:44.006:ERROR / AndroidRuntime(293):在android.app.ActivityThread.handleCreateService(ActivityThread.java:2024)