我想要得到包裹名字 and 班级名称收到的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>
如果我因为无法正常工作而缺少任何许可,请告诉我。
我个人认为这种行为很烦人。当然它是多余的:已经有其他机制可以解决相同的问题(屏幕锁定、加密)。
当操作在您这边时(即:删除帐户、更改电子邮件等),我只会使用额外的检查。
如果我这么做不是为了阻止你这么做here's https://stackoverflow.com/questions/18692571/how-it-works-warning-that-app-is-going-to-be-uninstalled另一篇文章按照类似的方向解决了相同的问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)