受信した のパッケージ名とクラス名を取得したいのですが、取得intent
できません。アンインストールする前にパスワードを要求するように、アプリを安全にしたいと考えています。アプリをインストールしたユーザーのみがパスワードを知っているため、そのユーザーのみがアプリをアンインストールできます。
レシーバーの私のコード:
public class PackageReceiver extends BroadcastReceiver {
@ Override
public void onReceive (Context context, Intent intent) {
if (intent.getAction().equals("android.settings.APPLICATION_DETAILS_SETTINGS")) {
/ / TODO:
//I want here to get this getAction working and then I want to fetch package and class of the intent
}
}
}
マニフェスト:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<Application
android: icon = "@ drawable / ic_launcher"
android: label = "Test">
<Receiver android: name = ". PackageReceiver"
android: label = "@ string / app_name">
<intent-filter>
<action android:name="android.settings.APPLICATION_DETAILS_SETTINGS" />
<data android:scheme="package" />
</ Intent-filter>
</ Receiver>
</ Application>
これを機能させることができないため、許可が不足している場合はお知らせください。