-
Notifications
You must be signed in to change notification settings - Fork 70
Can't request location updates via pending intent from non-ui thread #131
Comments
Interesting this is exception occurs pretty deep inside the Do we know if this use case is supported when calling [ |
It seems this is the expected behavior and is even documented as such in Google Play services. Closing this issue now but feel free to re-open if you find any deviations between Lost and the Google Play services version. |
@ecgreb I think you are looking at the wrong method. If that's the case, this quoted part from Google Play Services: "This method is suited for the background use cases, more specifically for receiving location updates, even when the app has been killed by the system" won't work as specified since with the death of the main thread, delivery of locations will stop? I am asking for this because I am looking for a reliable way for my Background Service to be waken up if killed by delivery of location intent. |
Ah yes so I was looking at the wrong method sorry about that. I will take another look at the issue requesting updates from a non-UI thread with a |
@amayatsky this has been resolved in the |
Description
Request location updates via pending intent from a service, from non-ui thread fails.
Steps to Reproduce
Simply request location updates from a non-main thread.
Lost & Android Version
2.1.1, Android 7.0 (24)
Log
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:200)
at android.os.Handler.(Handler.java:114)
at android.location.LocationManager$ListenerTransport$1.(LocationManager.java:239)
at android.location.LocationManager$ListenerTransport.(LocationManager.java:239)
at android.location.LocationManager.wrapListener(LocationManager.java:871)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:884)
at android.location.LocationManager.requestLocationUpdates(LocationManager.java:471)
at com.mapzen.android.lost.internal.FusionEngine.enableNetwork(FusionEngine.java:133)
at com.mapzen.android.lost.internal.FusionEngine.enable(FusionEngine.java:107)
at com.mapzen.android.lost.internal.LocationEngine.setRequest(LocationEngine.java:45)
at com.mapzen.android.lost.internal.FusedLocationProviderServiceImpl.requestLocationUpdates(FusedLocationProviderServiceImpl.java:65)
at com.mapzen.android.lost.internal.FusedLocationProviderService.requestLocationUpdates(FusedLocationProviderService.java:74)
at com.mapzen.android.lost.internal.FusedLocationProviderApiImpl.requestLocationUpdates(FusedLocationProviderApiImpl.java:127)
at *.BackgroundLocationService.requestUpdates(BackgroundLocationService.java:168)
The text was updated successfully, but these errors were encountered: