Questions tagged [powermanager]

PowerManager is a class in the Android SDK that gives control of the power state of the device.

PowerManager is a class in the Android SDK that gives you control of the power state of the device.

Device battery life will be significantly affected by the use of this API. Do not acquire PowerManager.WakeLocks unless you really need them, use the minimum levels possible, and be sure to release them as soon as possible.

You can obtain an instance of this class by calling Context.getSystemService().

The primary API you'll use is newWakeLock(). This will create a PowerManager.WakeLock object. You can then use methods on the wake lock object to control the power state of the device.

Reference page: http://developer.android.com/reference/android/os/PowerManager.html

109 questions
1
vote
1 answer

Unable to Wake phone and Display Activity when the phone is locked

I am Launching an activity from the service. I am acquiring the partial wake lock before the service is started. PowerManager mgr =…
isumit
  • 2,313
  • 4
  • 23
  • 28
1
vote
1 answer

How to test Wake Lock

I'm working on a fairly complex application and I am using alarms to wake the device when needed and to acquire a wake lock until the task is over. This happens in different places in code. I'm fairly certain my logic is correct but it's very hard…
Randy
  • 4,351
  • 2
  • 25
  • 46
1
vote
0 answers

Push notification turns off my app

I´m doing a game on Android. I´m using gcm push notifications and basically what I´m doing with the push is check their content in order to know if push has a winner or loser value , if has a win value and the user is on the screen "waiting result"…
JoCuTo
  • 2,463
  • 4
  • 28
  • 44
1
vote
0 answers

turn off the display even if the app is in background

I use the following code to create on the flight a window used as preview when a picture is taken: void CreatePreviewDialog() { dummy_frame_layout = new DummyFrameLayout(context); wm_params = new WindowManager.LayoutParams( …
user2923045
  • 369
  • 2
  • 6
  • 16
1
vote
1 answer

If an app holds a partial wake lock and the phone is woken up, do other processes get access to the CPU too?

It's been a longtime assumption of mine that when a WakeLock is held the device's CPU is fair game for all running processes. Does this assumption hold? As an example, suppose processes A, B, and C exist. The phone has been asleep for 4 hours and…
Dylan Knowles
  • 2,726
  • 1
  • 26
  • 52
1
vote
0 answers

Android - What is the correct way of turning off screen

This is a little bit tricky. Background: there is an old GalaxyNexus whose power button is not functioning very well. I have to press hard to turn on/off screen and this is very annoying! Solution: I have downloaded the newest AOSP and build my own…
Robin
  • 10,052
  • 6
  • 31
  • 52
1
vote
1 answer

android turn screen off and on

I've made a simple application to turn the screen on and off once a button is pressed, the code does not present any error but it doesn't do anything. Here is the code: protected void onCreate(Bundle savedInstanceState) { …
user2115240
  • 29
  • 2
  • 11
1
vote
3 answers

Android : How to use PowerManager.wakeUp?

I want to use the method wakeUp of PowerManager. Eclipse (ADT) don't reconize this method. But there is no problem for the opposite "goToSleep" : PowerManager pm = (PowerManager)…
Alabate
  • 74
  • 1
  • 3
  • 12
1
vote
0 answers

Turning screen on and off programmatically not working on some devices

I use the code below to turn the screen on and off. Both pieces of code work on most devices (tested on Galaxy Note, Galaxy S2, etc. etc.) but don't work on a few (mostly tablets but some phones as well). On some devices screen on works but screen…
1
vote
1 answer

embedded Linux suspend/resume reference power manager

I'm currently implementing suspend/resume for embedded Linux on some non-android network device. The requirement is to implement a sleep manager task in kernel which would trigger system suspend in case that no task is currently running and there's…
1
vote
1 answer

How to prevent an Android application from locking?

I am currently making an Android application in which I need the phone to not lock, so as to avoid the activity losing focus. I have done a bit of research and found numerous ways to do it including the use of: Keyguard Manager Power…
Aelexe
  • 1,216
  • 3
  • 18
  • 27
1
vote
1 answer

get phone off sleep in receiver

My app needs to play a ringtone if an sms is coming in (broadcastreceiver). It's functioning correctly if my phone is on. But in sleep the SMS is coming in and nothing is happening. If I get the phone from standby...my ringtone is playing....…
user1404924
  • 95
  • 1
  • 2
  • 11
0
votes
1 answer

setting up broadcast Receiver to turn on bluetooth

I'm a newbie in both Java and Android and I'm trying to figure out how to do the following action. Btw, I find that the official Google Android documentation is NOT for newbies and would like any referral to something a bit more... non-native…
raingod
  • 1,377
  • 1
  • 11
  • 24
0
votes
1 answer

How to turn wakelock off?

I'm tryng to turn proximitywakelock on when portrait and off when landscape using this code, but it always stays active: //in onCreate() of my Activity PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); …
Angelo Tricarico
  • 1,333
  • 1
  • 19
  • 36
0
votes
1 answer

Can my Android application use PowerManager's reboot method?

Since API level 8 PowerManager has contained a reboot() method. I've added the required permission to my manifest, acquired the PowerManager object and call pm.reboot(); This results in a force close with this stack trace 01-04 16:58:35.847:…
FoamyGuy
  • 46,603
  • 18
  • 125
  • 156