Is there any way to "Power on" the device in case some alarm happens ?. This was available in old Nokia phones when you set an alarm , if the device is OFF , the devices goes on at the alarm time, then goes OFF again. Can we have this in Android ? . I'm not talking about waking up the device while sleeping, I need to power it on if he is OFF and have battery power.
Thanks alot
This isn't possible with android because once your device is shut down, the OS isn't running until the device is manually switched on.
However, with root access you can schedule a system shutdown with an alarm but you'll need a rooted device which can void your warranty.
Related
Is it possible to have a broadcast receiver when user turns off Ultra Power Saving Mode (Samsung) or Ultra Stamina Mode (Sony) and so with Ultra modes implemented by different device vendors?
I have a alarm manager running which triggers my IntentService after a certain interval, when I turn on Ultra mode on either Sony or Samsung, alarm manager is not available, but when I turn off the ultra mode, I want the action broadcasted so that I can receive it and start my alarm manager as normally we do on Boot_Completed.
I found some info online, such as POWER_SAVE_MODE but it also stated it was only available in lollipop.
Appreciate the help.
Thanks
First of all this way only tested on Samsung device with Android 4.4 API 19.
All you have to do is just treating turning off the ultra power saving mode as BOOT_COMPLETED action.
Which means simply you have to make your activity or service (whatever initiating the AlarmManager) start with system boot up so that it start after turning off the ultra power saving mode.
Ultra Power Saving Mode is not enabled or available in the stock android or does not have any documentations whereas sony tries to kill some apps or some sensors to keep the battery for more time.
I have an app which is running on an android device which has no battery. It's just charging all the time and the app is running. But sometimes the device is not charging and logical to that the phone will turn off.
When it's charging again the device should start from itself and boot. The user shouldn't press the power button. That's the requirement.
Is this possible anyway?
Can I achieve this when I root the device?
Has anybody experiences with that case?
in short: No.
ADB is not running when the phone is powered off, and as #langerhans said, wake on alarm is proprietary
You could do a hardware solution where you hijack the battery pins to a power station or modified charger. (make sure you do not feed any power through usb at the same time)
It should be cheap and quite easy to build.
Generally, this is not possible. It is highly device dependant. Some devices allow alarms turning on the phone to ring as an alarm clock even if they are turned off. But this is a proprietary feature and therefore not easily accesible to custom applications.
I have basically the same problem running an Odroid device which luckily turns itself on after power loss, but if I shut it down manually, I can only turn back on with pulling the power.
The only thing I could think off would be an extra watchdog device, but I have no idea if something like that exists. Maybe you'd need to build it yourself.
I was searching SO and web but i couldn't find sufficient answer for my particular question. Ok here we go:
Every user can modify screen timeout on android. (when screen turns off when its idle for __ seconds/minutes - users choice ). But user can modify ONLY screen timeout and not when device goes actually to sleep. I found here what happens when device goes to sleep: (Really nice answer by CommonsWare) Android Sleep/Standby Mode
Ok my question is simple. How do i know when my phone will go to sleep? Will it go to sleep immediately after turning screen off? Will it stay "awake" a while after screen was turned off? And most important: Does sleep mode in particular device varies from brand device ( how manufacturer implement this ) or it depends on ROM version (For instance, all ICS powered devices will go to sleep X seconds after screen was turned off )?
You can never really be sure if the device has gone to sleep. At best, I can give you a list of things that would make sure that the device hasn't gone to sleep:
Screen being on - Requires CPU and GPU, and hence RAM, to stay active
Any app holding a wakelock - Even the lowest wakelocks keep the CPU on, though the screen may be switched off
Apart from this, there is no guarantee that the device will go to sleep n seconds after the screen is turned off, even if no wakelocks are being held. This is upto the OEM, and they can alter this.
Keep in mind that Android devices have an option to keep the device unlocked for a certain amount of time after the screen has gone to sleep.
There is small difference in power consumption when you compare a phone with laptops.
Laptops most of the times runs on direct power through charger. (Mostly we carry charge with laptop).
Mobiles mostly run on battery power. (Rarely we carry charger with us).
By keeping this in mind, android has designed in a such a way that, phone will not consume battery power if user is not interacting with the phone. This is to increase battery back up time for user.
That's why when LCD screen power is off (that means user is not interacting with phone), with in fraction of seconds CPU will also go to a mode (sleep mode) where it does minimal work and saves battery power. When CPU is in sleep mode, it accepts commands only from RIL (radio interface layer) which is basically SMS and call functions, and alarms. Other than this CPU will stop executing other applications functions.
Note : If any application wants CPU time for its emergency work when CPU is in sleep mode, then it can request CPU time by using WAKE LOCKS.
For eg : MP3 application has to keep playing songs in its service, even though user has turned off LCD screen. That means MP3 application's service has requested CPU time by using WAKE LOCKS.
Your question : How do i know when my phone will go to sleep?
- Ans : Simple it goes sleep mode when LCD power is off, with in fraction of seconds.
Your question : Does sleep mode in particular device varies from brand device
- Ans : Since android is open source, any OEM can take driver layer , which is GPU license and can modify the power manager drive to behave differently. All these sleep modes and wake locks are finally under control of Power manager driver of Linux kernel layer.
for testing sleep mode/doze in Android 6.0 you should use next commands:
$ adb shell dumpsys battery unplug
$ adb shell dumpsys deviceidle step
more info see here: Optimizing for Doze and App Standby
I cannot get some Android devices to wake up using the AlarmManager. Following the advice in other StackOverflow posts, I am testing CommonsWares cwac-wakeful demo unmodified, compiled in Eclipse, and sent directly to my tablet devices.
When the screen is on the app wakes every 15 minutes and dutifully writes a log message, if I switch the screen off (short press on the power button) and remove the USB cable, then reconnect say 30 minutes later, there are no log messages for the period during which the device was asleep. The alarm does trigger immediately after I wake the device up (according to the log message timestamp). If I leave the USB cable connected the alarm does trigger even with the screen off, presumably because the device is in "debug" mode.
I have seen this behaviour on an older Android 2.2 tablet and I think it might be a bug in the hardware or OS common to both devices. However, I would like to rule out a bug in the cwac-wakeful utility and "operator error" if possible.
Has anyone else seen this behaviour and have any suggestions about further diagnostics or remedies?
I actually get the same behaviour when I set the built-in clock alarm from the home page, i.e. the A90 and the VEGAn-TAB don't wake up until the next manual power on. Therefore it must be a fundamental problem with the tablets rather than a bug in AlarmManager or WakefulIntentService.
I'm Developing an Android Application where it's constantly required to keep the App up an running at all time. with the phone connected to a power outlet at all time, Is it possible that if the phone's battery died to Auto-start up the app with no user intervention . *i.e to power up the phone automatically without hitting any power button and start up android since charger is connected. *
then start up my app with android.intent.action.BOOT_COMPLETED and RECEIVE_BOOT_COMPLETED permission
PS: I have tried android.intent.action.ACTION_POWER_CONNECTED but it only works if the phone is already powered up.
I have exactly same requirement as yours.
Can we plan a solution like this:
The Android device is always connected to charger's output.
Charger's power supply is connected to a custom made hardware device which controls power supply to charger.
This hardware device puts charger off until battery is getting low. i.e. 20% remaining.
Once battery is less than 20%, that device automatically switch on the charger.
The "custom made hardware" gets it input from android device itself via USB/WiFi/Bluetooth.
Just a thought. May not be practically possible.
No way doing it if you do not root your device and add reboot scripts to the programs running to show battery charging pictures when device is turned off and charging.for Samsung s2 here is an answer
Maybe you can make an additional app that waits for the BOOT_COMPLETED with its BroadcastReceiver and then check wether the power is connected and start as a new Intent your application?
Just a quick thought..
I have the same problem.
The solution that i will to implement:
1.- get out two(here is my doubt, ¿what two wires?, because i see three, i will use my multimeter for see continuity between wires when i push the button) wires from the power button phone.(when you push that button, it just connect two poles like a switch).
2.- When you have the two wires, so, we build a little circuit with a timer like a 555(integrated circuit). The purpose of the circuit will connect the two wires(from power button phone) by a 5 seconds period every 15minutes.
Obviously this circuit will be running always.