user3082623
user3082623

Reputation: 3

sendBroadcast is giving permission denied exception

I had below code to refresh local media store(Environment.DIRECTORY_PICTURES) Now suddenly this throws permission denied exception.

How do i solve this

Thanks

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
                Uri.parse(MainActivity.BASE_PATH + File.separator
                        + _orderNo + File.separator
                        + Constants.BASICINFO_FILE_NAME)));

Upvotes: 0

Views: 997

Answers (2)

CommonsWare
CommonsWare

Reputation: 1006819

That was never appropriate code in the first place, and it is now explicitly blocked as of Android 4.4.

Instead, use MediaScannerConnection or ACTION_MEDIA_SCANNER_SCAN_FILE to request indexing of new files.

Upvotes: 3

fweigl
fweigl

Reputation: 22028

First of all you should make a habit of posting your error logcat.

You probably are missing this permission in your manifest:

Upvotes: 0

Related Questions