Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Light up screen when notification received android

I have a service running for my application to send notification every hour. This is working fine as i heard a sound and a vibration every hour because of my notification but i also want that my notification light up my screen as well. But i am unable to light up my screen when notification appears.

like image 360
Pirate Avatar asked Mar 09 '12 09:03

Pirate


People also ask

How do I make my Android screen light up when I get a text?

On Android: Settings > Accessibility > Hearing > turn on Flash Notification.

Why doesn't my screen light up when I get a notification android?

Method 4: (For Android 11-based phones) You just have to go to the App Info section of the Phone/Dialer app. Press the app icon and click on the (i) icon for that. Thereafter click on Notifications and ensure All Phone Notifications are turned on.

How do I make my screen light up when I get a notification Samsung?

From Settings, tap Notifications, and then tap Brief pop-up settings. Tap Edge lighting style, and then customize your desired options. When you're finished, tap Done to set your changes.


1 Answers

PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); boolean isScreenOn = pm.isScreenOn(); Log.e("screen on.................................", ""+isScreenOn); if(isScreenOn==false) {     WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK |PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.ON_AFTER_RELEASE,"MyLock");     wl.acquire(10000);     WakeLock wl_cpu = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,"MyCpuLock");      wl_cpu.acquire(10000); } 
like image 84
Pradeep Sodhi Avatar answered Sep 20 '22 18:09

Pradeep Sodhi