IntentFilter installFilter = new IntentFilter();
installFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
installFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
registerReceiver(mInstallReceiver, installFilter);
用上述代碼註冊廣播監聽會收不到應用安裝的廣播
解決方法:
IntentFilter installFilter = new IntentFilter();
installFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
installFilter.addAction(Intent.ACTION_PACKAGE_REPLACED);
installFilter.addDataScheme("package");
registerReceiver(mInstallReceiver, installFilter);