Android: save sound as ringtone / SQLiteConstraintException

前端 未结 2 1456
粉色の甜心
粉色の甜心 2021-01-14 05:31

I\'m trying to save a sound as a ringtone in Android using this code. It works like a charm but will fail if I try to save a ringtone that has already been inserted.

相关标签:
2条回答
  • 2021-01-14 06:19

    I was having the same issue....it's because you don't have this permission in your manifest

    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
    

    Also, if you're using that tutorial, make sure you have this in your manifest as well...

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    

    I spent a good half an hour or so trying to figure out why the code wasn't working. I actually removed the try/catch just to see what type of error it would throw in the logcat, and it told me I was missing those permissions.

    0 讨论(0)
  • It is not caught because the exception is not in your code. It is not even in your process. It is in the process of the MediaStore content provider.

    0 讨论(0)
提交回复
热议问题