How to ensure smooth operation of Android?

I have a project requirement that requires the android to always be turned on with a service running in the background. Although I can handle part of the service starting from 2.2 using START_STICKY, I still cannot guarantee that the device is always on. Or at least if the connection to the power source should load automatically if it is turned off.

Is there any solution for this in the real world? Other than creating a new firmware, I need some ideas or a workaround. Thank.

UPDATE: I thought better is clearer. In my case, I do not use android as a mobile device, and there will be no user. Its use is similar to the hardware on which the android is running, which after installation with my application no one has access to it. And always connected to a power source and the Internet. Also, the user will have access to power controls.

I agree that this cannot be done from an internal application or using the Android API. But this is a real world problem, and I desperately need a solution to this. Any thing, not even related to programming, can be mechanical or any.

+3
source share
5 answers

, . , ( ). , . -, . , , , . , , - , .

, , , .

0

, , ... . , , , .

... API android .

0
 PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
            mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
                    | PowerManager.ACQUIRE_CAUSES_WAKEUP,
                   "Any String");
mWakeLock.acquire();
0

, ,

NoMoarPowah!

It can work on certain devices and requires rooting. You can boot your device if the charged battery is charged or 15% charged or you have enough juice to load.

Try it ...

0
source

Source: https://habr.com/ru/post/1791830/


All Articles