안녕하세요, 저는 응용 프로그램을 분석 할 수 있도록 응용 프로그램을 설치하려고합니다. 그리고이 예제를 사용하여 현재 응용 프로그램에서 패키지 설치를 수신 대기하는 stackoverflow에서 찾았지만 아무 것도 일어나지 않습니다. logcat.의도 PACKAGE_ADDED가 등록되지 않았습니다
void registerReceiver() {
IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addDataScheme("package");
}
public void onReceive(Context context, Intent intent) {
String actionStr = intent.getAction();
if (Intent.ACTION_PACKAGE_ADDED.equals(actionStr)) {
Uri data = intent.getData();
String pkgName = data.getEncodedSchemeSpecificPart();
//handle package adding...
Log.i("Logging Service", pkgName);
}
}
<receiver android:name="RealTimeActivity">
<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" />
</intent-filter>
</receiver>
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_ADDED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_CHANGED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_INSTALL" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REPLACED" />
(일부 응용 프로그램은 특정 방송을 수신 할 수 있도록, 살아 응용 프로그램 프로세스를 유지하기 위해 더미 끈적 서비스를 실행) : 동일한/현재 응용 프로그램 패키지에있는 경우 name = ". RealTimeActivity"> 또는 다른 위치에있는 경우 –