0

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>

しかし、アプリケーションをアンインストールすると、通知が届きません。実際には、インストール時に作成された連絡先グループを受信通知で削除したいと考えています。そのための提案はありますか?

4

1 に答える 1

1

私もこのことについて調査を行い、最終的に、アプリケーション内の特定のアプリケーションのアンインストールのイベントを取得する方法がないという結論に達しました。これは、Android が提供しないセキュリティ上の理由です。ただし、インストールされていない他のアプリケーションでいくつかのイベントを取得できます。

于 2011-12-02T11:30:24.917 に答える