permission exception on Lollipop only and pre-Lollipop NOT

195 views Asked by At

Anyone have worked with RingToneManager?

I have this method which get the ringtones names and their uri available on mobile device

http://pastebin.com/KGTw3kab

it works on pre-Lollipop devices (KitKat) well and everything is perfect but when I run it on Lollipop device it gives this exception

"requires android.permission.READ_EXTERNAL_STORAGE"

-please don't tell me to add READ_EXTERNAL_STORAGE permission because it's added and the app works on pre-Lollipop devices only and that's the problem.

1

There are 1 answers

0
CommonsWare On BEST ANSWER
<uses-permission android:name="ANDROID.PERMISSION.READ_EXTERNAL_STORAGE" />

Android is case-sensitive in most places. Please change this to:

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

With respect to the change in behavior on Android 5.0, they now require you to be able to read external storage to access stuff from MediaStore that resides on external storage. This is not unique to ringtones.