In Android 7 you can long click a notification and choose to that notifications from the belonging app should be displayed without sounds.
For Android 7 we have NotificationManager.areNotificationsEnabled()
to check if user have blocked the notifications for your app. How do you check if the user have just disabled the sounds for the notifications for the app?
Update: The question still stands for Android 8/O. We have a few users who complain about not hearing any sounds and then they have disabled it without knowing it and without us having a chance to check it.
Open your device's Settings app . Tap Accessibility. Sound Notifications. Tap Open Sound Notifications.
Try these steps: Go to Settings > Sound & Notification > App Notifications. Select the app, and make sure that Notifications are turned on and set to Normal. Make sure that Do Not Disturb is turned off.
Tap Settings. . Tap Notifications. Turn Disable sounds & vibrations on or off.
Sounds are enabled at IMPORTANCE_DEFAULT and upwards, so you can check like this:
@RequiresApi(26)
private boolean hasSoundsEnabled(String channelId) {
NotificationManager manager = getSystemService(NotificationManager.class);
NotificationChannel channel = manager.getNotificationChannel(channelId);
return channel.getImportance() >= NotificationManager.IMPORTANCE_DEFAULT;
}
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