Frage

Ich bin eine App mit Alarmfunktion zu schreiben, das heißt es wird hat weiter ausgeführt werden, während das Gerät in der Standby geht. Offensichtlich ist dies nicht der Fall. Wie kann ich das erreichen?

Es wäre noch besser, wenn ich das Gerät aus, die in Standby überhaupt verhindern könnte - kann ich das

War es hilfreich?

Lösung

Android applications can prevent the device from going into standby with a wake lock but this should be used only for short periods of time for specific tasks which require the user to look at the screen without touching it.

For any other long time purposes, you have to use the system AlarmManager to schedule future actions of your application.

Using a permanent wake lock would make your app a battery drainer.

Andere Tipps

A service runs always, even in standby, so you should use it.

Preventing standby can be done with a wake lock. Be careful, there are only a few apps that should prevent standby (like games, video players...).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top