Does a android App work if phone is switch off [closed]
Asked Answered
G

8

5

Whether it is possible to launch an android application like alarm while the phone is switched off.

Graver answered 18/9, 2015 at 4:54 Comment(1)
Yes anyway thanks for your answersGraver
V
5

Technically Android is based on a modified Linux kernel and all processes running in Android are regular Linux processes. As such, when the kernel goes down then all processes also shutdown.

Alarm Manager is a system service which is running, along with other system services, inside a single Linux process (System Server) through its Dalvik VM instance. As I've already said, System Server is also a Linux process like other processes and will shutdown once whole kernel has stopped running.

Basically, all Android system services (e.g. Notification manager, Package manager, Camera, ...) are running inside that System Server standalone process. (However, in newer versions of Android some of them are slitted up to multiple processes). And this process is no longer running whenever the kernel stops.

Vassalage answered 29/9, 2015 at 14:13 Comment(0)
S
8

A bug had been filed almost 5 years ago regarding Android device's alarms not triggering when device is turned off.. It's status was then changed to "enhancement request"

And as you go deep down in that thread, you can see that it was "declined" . So officially Android doesn't support it, however some vendors have implemented this feature in their vendor specific ROM.

Spinous answered 18/9, 2015 at 5:23 Comment(0)
V
5

Technically Android is based on a modified Linux kernel and all processes running in Android are regular Linux processes. As such, when the kernel goes down then all processes also shutdown.

Alarm Manager is a system service which is running, along with other system services, inside a single Linux process (System Server) through its Dalvik VM instance. As I've already said, System Server is also a Linux process like other processes and will shutdown once whole kernel has stopped running.

Basically, all Android system services (e.g. Notification manager, Package manager, Camera, ...) are running inside that System Server standalone process. (However, in newer versions of Android some of them are slitted up to multiple processes). And this process is no longer running whenever the kernel stops.

Vassalage answered 29/9, 2015 at 14:13 Comment(0)
K
2

@Anand Jain : Sorry .Android Does not Support This .

Working Process Of Alarm Manager

When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running.

Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted.

Courtesy

AlarmManager has access to the system alarm .services.getSystemService(Context.ALARM_SERVICE). This intent starts the target application if it is not running. It is recommended to use AlarmManager when you want your application code to be run at a specific time, even if your application is not currently running.

AlarmManager when the phone is turned off - ANDROID

https://code.google.com/p/android/issues/detail?id=1942

Karbala answered 29/9, 2015 at 11:13 Comment(0)
D
1

No, if the phone is off, it can't do anything.

Denary answered 18/9, 2015 at 4:57 Comment(9)
@AnandJain Huh? My phone doesn't trigger alarms while it's switched off...Muttra
@AnandJain, When android phone is off, Alarm can't work, The old nokia did it - I was expecting the smarter android (Galaxy S GTI9000) to do even better... but hence - Nothing!Denary
do you mean that when you press power button to switch the phone off the AlarmManager is not working?Mystical
@pskink, I tried in my phone its not working.Denary
so how come phone's alarms work? those which are used in AlarmClock application?Mystical
@pskink, can you send me apk file? so I can check. Because I tried in 3 different devices, when phone is switched off Alarm not works.Denary
just launch the stock AlarmClock appMystical
Let us continue this discussion in chat.Denary
alarm manaager work doesn't matter device is on or offHeterophyllous
S
1

NO, it is not possible to launch any android application when phone is switched off!!

Streamy answered 23/9, 2015 at 7:21 Comment(2)
how alarm is work???Graver
have a look at this: android.stackexchange.com/questions/4206/…Streamy
C
1

Alarm does not work when device is off by default in Android as it should be supported from lower layers of platform stack which are vendor specific.

Some vendor chose to implement this feature and some does not.

refer this link for more details.

Coming back to question, yes it is possible to wake device from power off provided you have access to lower layers (firmware) of platform stack and underlying hardware supports it, in short if you are working for a device vendor.

For normal 3rd party application developers it is not possible right now. It can be possible in future if android along with vendors deside to provide support for this feature.

Curvature answered 23/9, 2015 at 11:23 Comment(0)
I
1

No, It's not possible to run your code when device is turned off.

But yes., you can achieve functionality like Alarm(Since your are asking "how alarm is work?? ").

Step - 1 : You can use AlarmManager class for setting alarm.

Step - 2 : Store the value of time to trig alarm in SharedPreferences

Step - 3(Optional) : You may want to store some data with events of ACTION_SHUTDOWN or QUICKBOOT_POWEROFF when android device turn off, link1.

Step - 4 : You also get device boot event in andoid with the help of RECEIVE_BOOT_COMPLETED(link2), and at a time you can reset your AlarmManager with the difference of device current time and time you've stored in SharedPreferences.

Iggie answered 24/9, 2015 at 4:10 Comment(3)
can you provide some example or tutorialGraver
Sorry to inform you that I can not provide you source code and also I'm not able to find such a tutorial which meets with your requirement and these are different components of implementation that your need to put together in order to make it work. Max I can provide you is above flow and reference links for achieving your functionality.Iggie
OK thanks i manange all these things @IggieGraver
O
1

No, If the phone is off, it can't do anything. If it's in sleep mode where the screen is off and it's not in use then the alarm will still function as will other types of notifications. I have never tried this specifically on a Galaxy S but I am fairly confident this is a universal rule.

Obscurant answered 30/9, 2015 at 4:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.