Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in oreo devices #1

Open
aNnYvIrUs opened this issue Nov 29, 2018 · 6 comments
Open

Not working in oreo devices #1

aNnYvIrUs opened this issue Nov 29, 2018 · 6 comments

Comments

@aNnYvIrUs
Copy link

Process: oak.shef.ac.uk.testrunningservicesbackgroundrelaunched, PID: 21844
java.lang.RuntimeException: Unable to start receiver oak.shef.ac.uk.testrunningservicesbackgroundrelaunched.SensorRestarterBroadcastReceiver: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=oak.shef.ac.uk.testrunningservicesbackgroundrelaunched/.SensorService }: app is in background uid UidRecord{5813532 u0a200 RCVR bg:+1m0s42ms idle procs:1 seq(0,0,0)}
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3399)
at android.app.ActivityThread.-wrap18(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=oak.shef.ac.uk.testrunningservicesbackgroundrelaunched/.SensorService }: app is in background uid UidRecord{5813532 u0a200 RCVR bg:+1m0s42ms idle procs:1 seq(0,0,0)}
at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1538)
at android.app.ContextImpl.startService(ContextImpl.java:1484)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at android.content.ContextWrapper.startService(ContextWrapper.java:663)
at oak.shef.ac.uk.testrunningservicesbackgroundrelaunched.SensorRestarterBroadcastReceiver.onReceive(SensorRestarterBroadcastReceiver.java:16)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:3392)
at android.app.ActivityThread.-wrap18(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1780) 
at android.os.Handler.dispatchMessage(Handler.java:105) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6944) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 

@jeroenbeuz
Copy link

Same happens for me. However sometimes it does work. Will post any further findings here.

@Saceone
Copy link

Saceone commented Feb 17, 2019

Not working when app is swiped from recent apps list
any solutions?

@fabcira
Copy link
Owner

fabcira commented Feb 17, 2019

It works on a Samsung S8 (SM-G950F) with Android 8.0. What phone causes a problem?

@shofin-islam
Copy link

Not working when app is swiped from recent apps list. (log is stuck)
Why pressing back is calling service destroy()?

any solution?

@CydeSwype
Copy link

Same issue for me, but on Pie. OnePlus 5T OxygenOS 9.0.4 (Android version 9). Also happens on virtualized Nexus 5X. Trigger appears to be memory pressure (i.e. opening Maps app on the virtualized Nexus 5X is enough to usually cause Android to kill the background process).

@CydeSwype
Copy link

This summary from Android team makes it pretty clear that they're not trying to allow any workarounds for silent background processes that are long-running and reliable: https://developer.android.com/guide/background They consider battery and RAM impact top-priority issues for users' experience and that anything like a pedometer use case should be spawning a foreground service (so that a user knows that there could be battery and RAM impact and decide to uninstall the app). I don't think Android has done enough to explain to end-users that this was a big shift in the experience with the advent of Oreo. I still talk to users all the time that HATE sticky notifications and they don't appreciate that Android is trying to enforce transparency. They just want them gone (which forces us app makers to take on the burden of explaining how Android works to end-users). Short of Android team reversing their course on this policy, I think any workarounds for highly responsive background processes will be short-lived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants