Skip to content

Instantly share code, notes, and snippets.

@gotoark
Created November 15, 2017 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotoark/206de99ee2cbc527291c44b644817676 to your computer and use it in GitHub Desktop.
Save gotoark/206de99ee2cbc527291c44b644817676 to your computer and use it in GitHub Desktop.
Set Ringtone
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