Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Turn screen ON and notify user

I have some Intent. When intent fires, I want to send a popup notification like an AlertBox and turn screen ON to let User see the notification immediately (I mean without showing a lockscreen).

If you've used, for example, HandcentSMS then you understand what I mean (like a popup notification when accept a message)

How to organize this? Any code examples? What kind of permissions I have to use?

Thank you in advance.

like image 897
Ksice Avatar asked Sep 06 '25 04:09

Ksice


1 Answers

Check out PowerManager.

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag");
wl.acquire();
//Do whatever you need right here
wl.release(); 
like image 96
Kevin Qiu Avatar answered Sep 09 '25 01:09

Kevin Qiu