いつ私のアプリがアンインストールされているかを検出する必要があります。そのために、私はlogcatがUNINSTALL_PACKAGEインテントを送信するのを見てきました。私はそれを単に既存のブロードキャストレシーバに追加しました。しかし、それだけでそれをキャッチしない、私が聞いている他の意図、TIME_TICKは、完全に動作します。どうして?Android:BroadcastReceiver:UNINSTALL_PACKAGEインテント
現在使用コード:
private IntentFilter intentFilter;
static {
intentFilter = new IntentFilter();
intentFilter.addAction(Intent.ACTION_TIME_TICK);
intentFilter.addAction(Intent.ACTION_UNINSTALL_PACKAGE);
}
private final BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(Intent.ACTION_UNINSTALL_PACKAGE) {
Log.e("App", "Uninstalling");
} else if (action.equals(Intent.ACTION_TIME_TICK){
// this works
}
}
};
[パッケージのインストールとアンインストールのイベントを受信する](http://stackoverflow.com/questions/7470314/receiving-package-install-and-uninstall-events)の可能な複製 – Beloo