stephanenicolas / robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Apache License 2.0
2.95k stars 545 forks source link

Android O background service limitations #467

Open bogdanzurac opened 7 years ago

bogdanzurac commented 7 years ago

How do the new background service limitations in the newest Android O Developer Preview affect RoboSpice? Even on earlier releases, when the Activity goes into background and a request hasn't finished yet, a blank notification is being shown.

Reference: https://developer.android.com/preview/features/background.html#services

stephanenicolas commented 7 years ago

Hi @bogdanzurac,

I don't think this can really have an impact on RS services. But it would be nice to test it and see how it behaves with the newest APIs.

Most of RS services do actually execute in the foreground, but this highly depends f the way an app uses RS..

Stephane

2017-04-02 21:22 GMT+02:00 bogdanzurac notifications@github.com:

How do the new background service limitations in the newest Android O Developer Preview affect RoboSpice? Even on earlier releases, when the Activity goes into background and a request hasn't finished yet, a blank notification is being shown.

Reference: https://developer.android.com/preview/features/background. html#services

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stephanenicolas/robospice/issues/467, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33QbEu1osuwbVkHAsOTiwWOtrNBlZks5rr_VpgaJpZM4Mw5vx .

Faltenreich commented 6 years ago

Actually I get an IllegalStateException when my app is awoken from the background by an registered alarm through the AlarmManager:

E/AndroidRuntime: FATAL EXCEPTION: SpiceManagerThread 0 Process: com.faltenreich.diaguard, PID: 5028 java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.faltenreich.diaguard/.networking.openfoodfacts.OpenFoodFactsService }: app is in background uid UidRecord{2d90d59 u0a84 RCVR 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 com.octo.android.robospice.SpiceManager.tryToStartService(SpiceManager.java:1170) at com.octo.android.robospice.SpiceManager.run(SpiceManager.java:247) at java.lang.Thread.run(Thread.java:764)

ransome1 commented 6 years ago

Hey there. We are facing similar problems: tryToStartService crashes on Android 8.x devices, since Google limited the backgrounds executions.

@stephanenicolas Is there any update for robospice in sight, that uses the new startForegroundService method for 8.x devices, as Google introduced here: https://developer.android.com/about/versions/oreo/android-8.0-changes.html

bogdanzurac commented 6 years ago

Should seriously consider switching to the new, official Android Arch Components. I wouldn't recommend RS on any new project. Now don't get me wrong, it was a very useful library for a quite long time, but its architecture doesn't really suit where Android is at this point. Not to mention the fact that the library hasn't seen an update in over 3 years.

Again, I don't mean to offend anybody on the team, especially @stephanenicolas. You've done a tremendously amazing job with RS and all of us are extremely grateful for that. But I think it's time to call it in.

stephanenicolas commented 6 years ago

Thx a lot Bogdan for these kind words. But yes, we froze RS last week, the library is not maintained anymore. Personnally, I now always use a mix of retrofit and Rx instead, RS has sailed a long way home and yes, the latest constraints in android O don't make it easy for RS at all, it's probably the last nail in its coffin.

Thx to all RS users for your warm support, it's been a pleasure to ofer this library to the community. Thx to @rciovati too for his important contributions to RS !