mrmans0n / smart-location-lib

Android library project that lets you manage the location updates to be as painless as possible
1.65k stars 353 forks source link

Fails to start service on Android O due to background limitations #214

Open vladimirpetrovski opened 7 years ago

vladimirpetrovski commented 7 years ago
java.lang.IllegalStateException: Not allowed to start service Intent { 
io.nlopez.smartlocation.geocoding.providers.AndroidGeocodingProvider$AndroidGeocodingService (has extras) }: app is in background uid UidRecord{944c447 u0a185 SVC  idle procs:1 seq(0,0,0)}
       at android.app.ActivityThread.handleCreateService(ActivityThread.java:3414)
       at android.app.ActivityThread.-wrap4(Unknown Source)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1683)
       at android.os.Handler.dispatchMessage(Handler.java:105)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6541)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by java.lang.IllegalStateException: Not allowed to start service Intent { 
io.nlopez.smartlocation.geocoding.providers.AndroidGeocodingProvider$AndroidGeocodingService (has extras) }: app is in background uid UidRecord{944c447 u0a185 SVC  idle procs:1 seq(0,0,0)}
       at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1505)
       at android.app.ContextImpl.startService(ContextImpl.java:1461)
       at android.content.ContextWrapper.startService(ContextWrapper.java:644)
       at android.content.ContextWrapper.startService(ContextWrapper.java:644)
       at io.nlopez.smartlocation.geocoding.providers.AndroidGeocodingProvider.start(AndroidGeocodingProvider.java:102)
       at io.nlopez.smartlocation.SmartLocation$GeocodingControl.start(SmartLocation.java:302)
       at io.nlopez.smartlocation.SmartLocation$GeocodingControl.start(SmartLocation.java:282)
       at io.nlopez.smartlocation.SmartLocation$GeocodingControl.reverse(SmartLocation.java:245)

Check https://developer.android.com/about/versions/oreo/android-8.0-changes.html#back-all

galadril commented 6 years ago

+1 Geofence background service not working

If you want to capture the Geofence transitions without the app running, you can hook up a BroadcastReceiver to the intent action stored in the GeofencingGooglePlayServicesProvider.BROADCAST_INTENT_ACTION constant. The intent will come with the geofence, the location and the type of transition within the bundle.

rutvikwebmobtech commented 5 years ago

Same issue in Android 8.0

Fatal Exception: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.sterlingaccuris.android/io.nlopez.smartlocation.geocoding.providers.AndroidGeocodingProvider$AndroidGeocodingService (has extras) }: app is in background uid UidRecord{a04b76f u0a392 CAC  bg:+5m5s890ms idle change:idle procs:1 seq(177,177,177)}
derohimat commented 5 years ago

I faced same issue, any update for this ?

Siddharthyadav123 commented 2 years ago

Still facing the same issue and PR is still open. Can someone help me with alternative library to this one.

BurgerZ commented 2 years ago

@Siddharthyadav123 Hi mate, you can try this one - https://github.com/BirjuVachhani/locus-android It supports background location updates.

Siddharthyadav123 commented 2 years ago

thanks @BurgerZ