相关疑难解决方法(0)

无法接收PACKAGE意图的广播

我正在尝试注册广播接收器以接收包事件的广播事件.以下是清单文件中的代码和接收器.日志状态永远不会发生,但我可以清楚地看到"HomeLoaders"(Launcher)调试语句的相同广播触发.我错过了什么?

public class IntentListener extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        Log.i("INTENT LISTNER:", intent.getAction());
    }
}

<receiver android:name="IntentListener" android:enabled="true" android:exported="true">
    <intent-filter>
        <data android:scheme="package"></data>
        <action android:name="android.intent.action.PACKAGE_ADDED"></action>
        <action android:name="android.intent.action.PACKAGE_ADDED"></action>
        <action android:name="android.intent.action.PACKAGE_CHANGED"></action>
    </intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)

android

5
推荐指数
1
解决办法
3559
查看次数

标签 统计

android ×1