权限拒绝:广播意图不是出口意图、权限、不是

由网友(荒词旧笺)分享简介:我有以下的codeS:I have the following codes:sendBroadcast(新意图(Intent.ACTION_MEDIA_MOUNTED,Uri.parse(文件://+ Environment.getExternalStorageDirectory()getAbsolutePath()...

我有以下的codeS:

I have the following codes:

sendBroadcast(新意图(Intent.ACTION_MEDIA_MOUNTED,                 Uri.parse(文件://+ Environment.getExternalStorageDirectory()getAbsolutePath()))); 而在我的表现,我也补充道:

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory().getAbsolutePath()))); And in my manifest, I have added:

           <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"/>

我收到以下错误

I receive the following error

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

我不知道它为什么会拒绝。我怎么能解决呢???

I don't know why it will be denial. And how can I solve it???

如果你知道,请帮助我,请写的更详细。我只是一个初学者。

If you know, please help me, and please write more detailed. I am just a beginner.

非常感谢!

推荐答案

实施广播接收器,并添加它的定义清单文件:

Implement broadcast receiver and add it's definition to the manifest file:

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <!--...-->

    <receiver
        android:name=".CustomReceiver"
        android:exported="true" >
    </receiver>
</application>

在哪里CustomReciever延伸的BroadcastReceiver。

Where CustomReciever extends BroadcastReceiver.

阅读全文

相关推荐

最新文章