デバイス上の他のアプリケーションがインストールまたは削除されたときにブロードキャストを受信できるアプリケーションを作りたいと思います。他のアプリケーションがインストールまたは削除されたときにアプリケーションがブロードキャストを受信する方法
manifsetで私のコード
:AppListenerで
<receiver android:name=".apps.AppListener">
<intent-filter android:priority="100">
<action android:name="android.intent.action.PACKAGE_INSTALL"/>
<action android:name="android.intent.action.PACKAGE_ADDED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
</intent-filter>
</receiver>
:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class AppListener extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
// TODO Auto-generated method stub
Log.v(TAG, "there is a broadcast");
}
}
が、私はすべての放送を受信することはできません。私はこの問題は、アプリケーションのアクセス許可、任意のアイデアのためだと思う?
ありがとうございました。マニフェストで
"android.intent.extra.REPLACING" .. rup35hのarg1.getDataString @のthnx –
() "パッケージ:TheInstalledPackageName" ちょうど「パッケージのように:com.google.joke " – wangqi060934
' PACKAGE_INSTALL'は役に立たず、廃止され、Googleではこれまで使用されていませんでした。https://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_INSTALL – Solidak