Troubles play sound in silent mode on Android
问题 I am writing an android application to simply play an alarm no mater what mode the phone even if it is in silent mode. I found this question and used the code from the answer to override the current volume state. My code looks like this: Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); if (alert == null){ // alert is null, using backup alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); if (alert == null){ // alert backup is null, using 2nd backup