사용자가 언제 새 앱을 설치하는지 알고 싶습니다. 나는 방송 수신기를 사용했다.Android, 사용자가 앱을 설치할 때?
<receiver android:name=".NewInstallReceiver">
<intent-filter>
<action android:name="android.intent.action.package_added" />
<data android:scheme="package" />
</intent-filter>
</receiver>
코드 : 내가 PLAYSTORE에서 응용 프로그램을 설치할 때
public class NewInstallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String act = intent.getAction();
Log.e("ee", "new install" + intent);
if (Intent.ACTION_PACKAGE_ADDED.equals(act) || Intent.ACTION_PACKAGE_REMOVED.equals(act)) {
/* ContentResolver contentResolver = context.getContentResolver();
contentResolver.query()*/
}
}
}
난 더 로그를 볼 수 없습니다.
서비스를 사용해야합니까? 그렇다면 어떻게하면 무한 시간 동안 작동시킬 수 있습니까?
그래, 당신도? –