我有以下代码:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://" + Environment.getExternalStorageDirectory().getAbsolutePath())));
在我的清单中,我添加了:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.ACTION_MEDIA_MOUNTED"/>
<action android:name="android.intent.action.MEDIA_EJECT" />
<action android:name="android.intent.ACTION_MEDIA_SCANNER_SCAN_FILE"/>
<data android:scheme="file"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
我收到以下错误
07-20 13:16:31.203: WARN/BroadcastQueue(395): Permission Denial: broadcasting Intent { act=android.intent.action.MEDIA_MOUNTED dat=file:///storage/sdcard0 flg=0x10 } from com.example.Music_Exchanger (pid=11797, uid=10080) is not exported from uid 10016 due to receiver com.android.providers.downloads/com.android.providers.downloads.DownloadReceiver
不知道为什么会被拒。我该如何解决?
如果你知道,请帮助我,并请写得更详细。我只是一个初学者。
非常感谢!