I am displaying an activity in the lock screen from a background service, while the user is within a certain area, while the device is locked (Received GPS).
In the activity this code is:
protected void onCreate (bundle savedinstenstate) {... getWindow () AddFlags (WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); ...}
and it is being called from service like this:
if (inArea) {PowerManager pm = (PowerManager) mContext. GetSystemService (Context.POWER_SERVICE); If (pm.isScreenOn () == incorrect) {intentententent = new intent (mContext, mClass); WakeIntent.setFlags (Intent.FLAG_ACTIVITY_NEW_TASK); MContext.startActivity (wakeIntent); }}
When the user exits the area, the activity should no longer be seen in the lock screen but I can not get it.
I tried this when the user's GPS area is out of:
if (! InArea) {android.os.Process.killProcess (android .os.Process MyPid ()); System.exit (1); }
But the activity is present in the lock screen.
Any suggestions on how to achieve this?
When the user exits, the service is transmitted. Activity register a broadcast receiver for that broadcast If it receives that broadcast, then it is eliminated.
Or a dozen variations on it - they will boil all the applications to inform when they kill themselves and now in the area.
No comments:
Post a Comment