Android, Flic2 and background...
pistonep last edited by
I m a currently trying to develop an application on Android that responds to Flic2 click.
It works well when application is in foreground and responds during certain time when application is in background.
But after one hour or so in background, the application stop responding to click (Flick Button led blink orange instead of green).
I do know about Phone killing background app so :
- I have a foreground service that uses : PARTIAL_WAKE_LOCK
- I have set my app to NO RESTRICTION in battery settings
- I have set my app to START when device start
Still... it s not working..
Can someone help me with that ? Is it a flic config problem ? Is it android's OS fault ? Is it a coding issue :(
Thanks for your help
A foreground service should be enough (at least according to Android's official documentation). A wake lock should not be used/needed. This works perfectly fine on "original" Android devices such as Google Pixel devices. Some chinese phone manufacturers might neglect the intended behaviour for a foreground service and kills the process anyway though after some undocumented rules, unless the app is white listed or similar.
The sample application at https://github.com/50ButtonsEach/flic2lib-android-sample uses a foreground service. You can check that out.