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

For developers, have two sections: Detect and workaround #31

Open
sandebert opened this issue Jan 15, 2019 · 2 comments
Open

For developers, have two sections: Detect and workaround #31

sandebert opened this issue Jan 15, 2019 · 2 comments

Comments

@sandebert
Copy link

The "Solution for developers" section is great, but even better would be if that section had two sub-sections:

  • How to detect
  • How to workaround

I imagine that there might be some cases where it's possible to detect, but not workaround. And in that case we could simply show the user some info, like ”This app is being choked by your phone, here's how to fix it blah blah blah”.

@petrnalevka
Copy link
Collaborator

Hello, this is good idea. But unfortunately at the moment do not know about a single vendor where you could detect this directly, so this section would be truly virtual.

On stock Android you can find out that battery saver is running, but I don't this this has direct effect on background processes anyway. You can see if app is or is not optimized on stock Android..

But for other vendors you would need to run a detection background process.. run something for quite a long time when not on charges for instance and see if it runs all the time..

@ocram
Copy link

ocram commented Feb 28, 2019

Right, on stock Android – and in general but with limited usefulness – you have android.os.PowerManager#isDeviceIdleMode() and android.os.PowerManager#isIgnoringBatteryOptimizations(java.lang.String).

When it comes to detecting if you are affected by any (vendor-specific) optimizations, our go-to solution has always been setting some flags or storing logs during the execution of background tasks or on delivery of notifications, so that you can check for success when the app is in the foreground the next time.

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

3 participants