Boot/Start automatically during charging

sangee

Member
Licensed User
Longtime User
Hello All...

I have been checking out on putting in a feature in my app which needs to be running 24/7 all days of the year. One primary issue faced was that in case the phone gets switched off due to battery drain ( !! surprisingly even though the charger is always connected to the device I notice that the battery gets drained completely once in a while.. not able to figure out why).

Workaround solution....

My concern and requirement was to turn on (boot) the phone automatically when the battery gets charged to 10 or 15% so the need to manually turn on the phone does not arise.

During my intense searches I came across the app "NoMoarPowah" in the Google play which seems to have the option of starting the phone even when it is switched off (needs a rooted phone).

Another piece of code I found was ..

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

I dont know what the above code does and if this meant to do the same thing like the app does. Can anyone please let me know what this code does? and how it can be adapted to B4A compatible mode.

If the above method works then my quest to have a android phone running all time is addressed...

Thanks and Regards,
Sangee :)
 
Top