android 监听系统新安装程序的广播

//监听系统新安装程序的广播,这块没用过
receiver = new MyReceiver();
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);//
filter.addDataScheme(“package”); //必须添加这项,否则拦截不到广播
registerReceiver(receiver, filter);

<receiver android:name=”common.ApkInstallReceiver”
android:label=”@string/app_name”>
<intent-filter>
<action android:name=”android.intent.action.BOOT_COMPLETED”/>
<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
<intent-filter>
<action android:name=”android.intent.action.PACKAGE_ADDED” />
<data android:scheme=”package” />
<!–[color=red] 注意!! 这句必须要加,否则接收不到BroadCast [/color] –>
</intent-filter>
</receiver>