java - How to ask user to unlock device on clicking notification action in android? -



      i displaying notification application , notification has action in it, when user clicks on action, corresponding action class called intent set. now, want perform particular action before user needs unlock screen if pin/pattern protected. not able ask user unlock device, i.e open unlock keypad/pattern on lock screen.
below code have,

    //handleaction java class extends intentservice     intent intent = new intent(context, handleaction.class);     intent.putextra(key, "my_value"); //used send information action class     pendingintent pi = pendingintent.getservice(context, 0, intent,                                  pendingintent.flag_update_current);      notificationcompat.builder notification = new notificationcompat.builder(mcontext);     //set title, icon etc builder , add action below     notification.addaction(icon, "my_label", pi); 

when user clicks on notification action, control onhandleintent in myaction.java
in here, want request user unlock device if password protected , perform action. how can request user unlock device in onhandleintent?

i came across using keyguardmanager , keyguardlock acheive keyguardmanager.newkeyguardlock deprecated method , want avoid this. so, next using "flag_turn_screen_on" , "flag_keep_screen_on" unable figure out how use them in context. don't launch window action class, operation incrementing counter. after clicking notification should disappear, perform action , thats it.

i found similar question unlock phone , way did launching dummy/empty activity.

thanks in advance help, suggestions :)

use activity intent in pending intent insted of service

intent intent = new intent(context, myactivity.class); intent.putextra(key, "my_value"); //used send information action class pendingintent pi = pendingintent.getactivity(context, 0, intent,                                  pendingintent.flag_update_current); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -