I'm looking to see if there's a system notification I can listen for to see when the screen turns off/on. Any thoughts? Something similar to when the network connects/disconnects.
You can disable this by tapping your profile icon > gear icon > Notifications > uncheck “Wake Screen” from within the app.
After turning on Wake screen when a notification is received, when you receive a notification, the phone will remind you. The notification content is displayed in conjunction with the lock screen notification, and you can see the notification information for the first time.
One example is Snapchat, a popular Android app that wakes the screen for notifications by default. You can disable this by tapping your profile icon > gear icon > Notifications > uncheck “Wake Screen” from within the app. If you don’t have any luck with the app itself, you can make the notifications “silent.”
To block notifications from certain apps only, learn how to change notifications by app. Important: Settings can vary by phone. For more info, contact your device manufacturer. Tap Apps & notifications Notifications. Under "Lock screen," tap Notifications on lock screen or On lock screen. Choose Show alerting and silent notifications .
Open the Settings on the device. Go to Apps & notifications. Select Notifications. Find "Notifications on lockscreen" and tap on the feature. Select "Don't show notifications" or "show alerting notifications only". The following applies to a Nokia 5 running Android 8.1 (which is more or less stock Android).
You can see all notification content on your lock screen by default. Open your phone's Settings app. Tap Apps & notifications Notifications. Under "Lock screen," tap Notifications on lock screen or On lock screen. Choose Show alerting and silent notifications. On some phones, choose Show all notification content.
Easiest way is to put this in your MyApplication.onCreate()
method:
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_SCREEN_ON);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
Log.d(TAG, Intent.ACTION_SCREEN_OFF);
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
Log.d(TAG, Intent.ACTION_SCREEN_ON);
}
}
}, intentFilter);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With