android - DevicePolicyManager, locknow when gcm message received -
i trying remotely lock phone when gcm push notification keyword arrives.
inside gcmintentservice class, within onhandleintent have included
message = extras.getstring("message"); if(message.equals("lock")){ gcmaction(message); } else{ sendnotification("message: " + extras.getstring("message")); log.i(tag, "message: " + extras.tostring()); }
so if message arrives saying lock, should go gcmaction method. otherwise go notification method.
private void gcmaction(string string) {
mdpm = (devicepolicymanager)getsystemservice(context.device_policy_service); //lock action mdpm.resetpassword(password, devicepolicymanager.reset_password_require_entry); mdpm.locknow();
}
sendnotification correctly showing notfications nothing happens when send "lock" ... can tell me missing ?
thanks
Comments
Post a Comment