抛出:IllegalArgumentException抛出requestLocationUpdate() [英] IllegalArgumentException thrown by requestLocationUpdate()

查看:191
本文介绍了抛出:IllegalArgumentException抛出requestLocationUpdate()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近测试我们的应用程序对机器人API级别14和15,我们开始把目标瞄准最小SKD版本8,不包括平板电脑(3.X)的发展。
随着2.x的一切运作良好,但在4.x的机器人运行的应用程序崩溃时在我们获得用户的位置点。

We recently tested our application against android API level 14 and 15. We started development targeting minimal SKD Version 8 and excluding tablets (3.x).
With 2.x everything works well but when running the app on a 4.x droid it crashes at the point we're obtaining user's location.

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to create service  java.lang.IllegalArgumentException: provider=network  
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2263)  
at android.app.ActivityThread.access$1600(ActivityThread.java:123)  
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)  
at android.os.Handler.dispatchMessage(Handler.java:99)  
at android.os.Looper.loop(Looper.java:137)  
at android.app.ActivityThread.main(ActivityThread.java:4424)  
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:784)  
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)  
at dalvik.system.NativeStart.main(Native Method)  

Caused by: java.lang.IllegalArgumentException: provider=network  
at android.os.Parcel.readException(Parcel.java:1331)  
at android.os.Parcel.readException(Parcel.java:1281)  
at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:646)  
at android.location.LocationManager._requestLocationUpdates(LocationManager.java:582)   
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:446)  
at package.name.LocationGetter.onCreate(LocationGetter.java:63)  
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)  
...

来源:

public void onCreate() {
  locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
  locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 300000, 500, locationListener);
  super.onCreate();
 }

根据<一href="http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates%28java.lang.String,%20long,%20float,%20android.location.LocationListener%29">documentation一个IAE被抛出如果提供者或listener为null 。 不过,我记录的提供者和倾听者。 (通过的toString后者()),而且他们不为空。

According to the documentation an IAE is thrown if provider or listener is null. However I logged the provider and listener. (the latter via toString() ) and they're not null.

即将从<一个href="http://stackoverflow.com/questions/4271041/problem-requesting-location-updates-by-network">this问题我发现了一个悬而未决的问题。但是我不知道如何人是更有信心与冰淇淋三明治的请求用户的坐标。
教程我知道使用上述相同的方法。

Coming from this question I found an open issue. However I was wondering how people that are more confident with ice cream sandwich request user's coordinates.
The tutorial I know of uses the same approach described above.

推荐答案

我觉得这可能是一个问题的Andr​​oid模拟器为present。

I think this may be an issue with the Android Emulator at present.

请参阅 HTTP://$c$c.google .COM / P /安卓/问题/详细信息?ID = 21237

这篇关于抛出:IllegalArgumentException抛出requestLocationUpdate()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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