I am unable to set ringtone using activity in android studio?

219 Views Asked by At

Sometimes it returns that unsupported mimetype and sometimes it returns invalid token

try to set ringtone in my app. But I am unable to do so by all mean I tried. I checked others code but I am not make it possible for me from others code. even all of these links provided below I didnt find my proper solution How to set Ringtone in android? Setting Ringtone in Android How to set Android ringtone from audio file stored in external storage

1

There are 1 best solutions below

1
Rosemarie Kristal On

If you're facing issues setting a ringtone in your Android app and getting errors like "unsupported mimetype" or "invalid token," make sure to:

  • Check your audio file format (e.g., MP3).
  • Ensure you have the necessary permissions (WRITE_EXTERNAL_STORAGE and WRITE_SETTINGS).
  • Verify the file path is correct and the file exists.
  • Use the provided code to set the ringtone.
  • Test your app on an Android device or emulator.

This should help you set a custom ringtone successfully.