android - Uninstall DevicePolicyManager app -
my app uses devicepolicymanager. if users want uninstall app have following steps:
settings -> location , security-> device administrator
deselect app , thay can uninstall it
i think not solution play store app. can these steps users in code can uninstall app launcher?
yes can. this:
devicepolicymanager dpm; componentname admin; try { dpm = (devicepolicymanager) getsystemservice(context.device_policy_service); admin = new componentname(youractivity.class, adminreceiveractivity.class); if(dpm.isadminactive(admin)) { dpm.removeactiveadmin(admin); } } catch(exception e) { e.printstacktrace(); } { intent intent = new intent(intent.action_delete); intent.setdata(uri.parse("package:" + this.getpackagename())); startactivity(intent) }
Comments
Post a Comment