java - Detecting a shake when Android is asleep and locked with service -
i want wake android device locked , asleep state single state.
what should use?
a wake lock keep service running , listening shake.
or possible same thing flags service?
will service receive if android device locked , asleep, if don't have wake lock?
update: wake lock ideal or unnecessary?
you can write service runs on background , listens event(shake)
as per flag can lock , unlock screen
//get window context windowmanager wm = context.getsystemservice(context.window_service); //unlock //http://developer.android.com/reference/android/app/activity.html#getwindow() window window = getwindow(); window.addflags(wm.layoutparams.flag_dismiss_keyguard); //lock device devicepolicymanager mdpm; mdpm = (devicepolicymanager)getsystemservice(context.device_policy_service);
Comments
Post a Comment