如何以编程方式找出设备和应用程序级别通知声音是关闭还是打开

时间:2019-01-13 18:14:43

标签: android

使用此代码查找:

try
{
   Log.d("Notification Sound",Settings.System.getInt( context.getContentResolver() ,
         Settings.System.NOTIFICATION_SOUND)+"  ");
}
catch (Settings.SettingNotFoundException e)
{
   e.printStackTrace();
   Log.d("Notification Sound error",e.getCause()+" ");
}

在Android 9设备中获取Settings.SettingNotFoundException。

0 个答案:

没有答案