我想在 Android manifest.xml 中注册一个有很多 Action 的接收器。
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
intentFilter.addAction(Intent.ACTION_PACKAGE_INSTALL);
intentFilter.addDataScheme("package");
registerReceiver(installReceiver,intentFilter);
我想不通。怎么做?
最佳答案
尝试:
<receiver android:name="getBroadcast" android:enabled="true" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED"></action>
<action android:name="android.intent.action.PACKAGE_CHANGED"></action>
<action android:name="android.intent.action.PACKAGE_INSTALL"></action>
<data android:scheme="package"></data>
</intent-filter>
</receiver>
关于android - 在 manifest.xml 中注册一个具有许多操作的接收器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11574671/