The program works while the device is active, as soon as the screen goes blank, the program also falls asleep. How to make the program work in the background and prevent it from falling asleep with the device, but continue to work? Searches on the Internet provide a description only for android for java, and I can not understand how to organize it in C # in VS Xamarin CrossPlatform. Please help. At least a couple of examples.
- Is this: xamarinhelp.com/xamarin-background-tasks ? - VladD
- This is all well and good, but here the example is based on the standard class used in Xamarin. And where to find examples using your own? I need the main function StartTimerOsnovnoy () to work in the background waiting for the current time to match the main one. Or how easier to say hibernate for my particular program. - Evgeny Torov
- I am not an expert on the Android platform, but I think that it is impossible to guarantee that the system will not unload your application. That is, you need to wait for the right moment in the service and wake up your application from there. - VladD
- I found the answer to my question here developer.android.com/guide/components/services.html?hl=en Thank you for your help. - Yevgeny Torov.
- Then maybe write an answer with a little meaningful squeeze this text? For future generations who will be interested in the same question. - VladD
|
1 answer
How to make the program work in the background and prevent it from falling asleep with the device, but continue to work?
use services , but reasonable. for events there are intent services , for storing state and executing functions there are bound services . Do not use sticky and / or foreground service unless absolutely necessary, as this greatly reduces battery power.
|