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
0
votes
1 answer

Is Windows Power Management User Specific?

I'm working with windows power management APIs (PowrProf.dll P/Invokes) in C# to get and set power management settings of the system, but I'm not sure if the power management settings are user-specific or machine-specific :( The flow for Windows XP…
Arashv
  • 305
  • 4
  • 15
0
votes
1 answer

waking up device in an activity started by AlarmManager

I have an app that starts a full screen activity at a given time (based on user settings). I need to wake up the device when this happens so the user can see the activity. I use AlarmManager to schedule these events and it seems to work fine (I…
drk
  • 398
  • 4
  • 13
0
votes
1 answer

PowerManager and PARTIAL_WAKE_LOCK

My app works fine when the device is plugged in the power supply whereas it fails (time to time) when the device is unplugged. I think that the piece of code responsible of this issue is as follows: PowerManager pm = (PowerManager)…
user2923045
  • 369
  • 2
  • 6
  • 16
0
votes
1 answer

PowerManager and PARTIAL_WAKE_LOCK behaviour

I use an alarm to take pictures at regular time intervals. I use a BroadcastReceiver as follows: @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "Capturing pic"); PowerManager pm = (PowerManager)…
user2923045
  • 369
  • 2
  • 6
  • 16
0
votes
1 answer

My PowerManager is not turning ON the device as expected

My code should generate a notification after 15 seconds of my pressing Button1. The notification code is in the service 'NotificationService'. Everything is working fine when my device is ON, but when I lock the device, I expect my code to turn the…
0
votes
1 answer

SecurityException even though permission is set

I´m trying to keep the screen on of the device with my app. PowerManager manager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = manager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK |…
Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136
0
votes
1 answer

Decipher - Excessive wake lock

I am getting message in log as below and then app is dying: Excessive wake lock in domain.mobile.app.MusicPlayer pid zzz held xxxx during yyyy My application is a music player. I didn't obtain any wake lock in initial version and player kept…
user2305886
  • 784
  • 8
  • 18
0
votes
1 answer

How to keep awake my android device

Right now my app has to stream music. I'm using a web server and everything works if the phone is awake or is plugged in to a power source. But I really need to continue streaming until the phone go to sleep. I'm using PowerManager…
David
  • 23
  • 6
0
votes
0 answers

How to resolve these multiple issues with DialogBox in alarmmanager event?

I have an alarmmanager onReceive event handler where I acquire wake lock. Need help to check if Powermanager handling right: public class PowerMgr { private static WakeLock wlstatic=null; synchronized public static void acquire(long timeout){ …
CKmum
  • 641
  • 6
  • 17
0
votes
1 answer

AlarmManager working well in emulator but not in real device

this is my code for setting alarm: public void SetAlarm(Context context, int tag, long time){ AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, Alarm.class); …
Shoshi
  • 2,254
  • 1
  • 29
  • 43
0
votes
1 answer

Battery performance using wakelocks

my app uses the commonsware wakeful pattern to wake the device up at a frequent (5 minute) repeating alarm interval. I know waking this frequently maybe the root of my problem, but the actual work done when the device wakes up is minimal and the…
Dom
  • 177
  • 1
  • 6
0
votes
4 answers

What vertical bar('|') means in android?

For example: WakeLock wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK| PowerManager.ACQUIRE_CAUSES_WAKEUP|PowerManager.ON_AFTER_RELEASE, "Alarm"); What does the ' | ' character mean? More details about the problem: I'm…
Rafael Ito
  • 37
  • 5
0
votes
0 answers

PowerManager.userActivity() does not turn the display on

I have a count-down timer activity and want to turn the display on when the timer is done. I tried PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); pm.userActivity(SystemClock.uptimeMillis(), false); but nothing happens,…
Oliv
  • 10,221
  • 3
  • 55
  • 76
0
votes
1 answer

How to change screen brightness?

How I can change screen brightness in Android? I can find how to do this for application, but I want do it for all system and permanently (until user changes it in options). I don't need to set it for custom value. Just low brightness level, Medium…
kolek
  • 3,690
  • 3
  • 24
  • 31
0
votes
1 answer

Wake device from BroadcastReceiver

I have an application that sets a repeating alarm and I would like it to wake the device, unlock the keyguard, do something and then release the lock ready to repeat again on the next alarm. It seems to work but the handset only wakes and unlocks…
Scott
  • 99
  • 1
  • 11