android - 在 manifest.xml 中注册一个具有许多操作的接收器

标签 android manifest

我想在 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/

相关文章:

android - Glide : Preload images in memory cache (with or without disk cache)

html - 不要使用缓存 list 缓存当前(索引)页面

android - manifest.xml 中的主题

android - (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE) 与 Accountmanager.get(context)

android - Twilio 发送有关 android 问题的文本

Android工具栏: Enable default Up button

android - 每次重建时,库中的 AppCompat-v7 都会将最低 sdk 版本更改为 7。我怎样才能永久修复它?

c++ - 将应用程序设置为需要提升?

Java NoClassDefFoundError 错误

android - 启用适用于 Android 的 Places SDK 时出现问题 (google)