public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if("android.intent.action.PACKAGE_REMOVED".equals(action))
{
String appName = intent.getDataString();
if(PACKAGE_NAME.equals(appName))
{
Log.i(TAG, "package removed, package name = "+appName);
}
}
}
<receiver android:name=".MyReceiver"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
本文介绍了一个Android应用如何通过BroadcastReceiver监听其他应用的安装与卸载事件,并展示了具体的实现代码。
2014

被折叠的 条评论
为什么被折叠?



