Created
November 15, 2017 18:57
-
-
Save gotoark/206de99ee2cbc527291c44b644817676 to your computer and use it in GitHub Desktop.
Set Ringtone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
if (Settings.System.canWrite(context)) { | |
RingtoneManager.setActualDefaultRingtoneUri( | |
context, | |
RingtoneManager.TYPE_RINGTONE, | |
newUri | |
); | |
}else{ | |
Log.e(TAG, "newUri: --------------------------------not granted this permission: android.permission.WRITE_SETTINGS" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment