我在 ApplicationBroadcastService.class 文件中的代码是:
public class ApplicationBroadcastService extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Activity a=new Activity();
Toast.makeText(context, " Uninstall ", Toast.LENGTH_LONG).show();
ContentValues values = new ContentValues();
values.put(ContactsContract.Groups._ID, 4444);
a.getContentResolver().delete(ContactsContract.Groups.CONTENT_URI,
values.toString(),null)
}
}
在menifest.xml 代码是:
<receiver android:name=".ApplicationBroadcastService">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
<action android:name="android.intent.action.PACKAGE_CHANGED" />
<action android:name="android.intent.action.PACKAGE_INSTALL" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
</receiver>
但是当我卸载应用程序时,我没有收到任何通知。实际上我想在接收通知中删除在安装时创建的联系人组。有什么建议吗?