Handle android device that doesn't have the DO not Disturb permission accessible?

92 Views Asked by At

So I have an app that needs do not disturb permissions, which I get like this:

NotificationManager manager = (NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE);
 
if (manager != null && manager.isNotificationPolicyAccessGranted()) 

But on some devices (Alcatel for instance) DND permissions aren't available. If a device doesn't have DND permissions I'd like to ignore them, if it does I'd like to require them for a certain feature.

Is there any way to programmatically check if a device has DND permissions accessible? I don't want my users getting "locked out" of the feature because of this 1 permission, but I also don't want other users to skip it if they want to use the feature and can grant the DND permission.

0

There are 0 best solutions below