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

后端 未结 2 1441
别跟我提以往
别跟我提以往 2021-01-02 22:09


      I am displaying a notification from my application and this notification has an action in it, when user clicks on the action, the c

2条回答
  •  一整个雨季
    2021-01-02 22:29

    Use Activity intent in pending intent insted of Service

    Intent intent = new Intent(context, MyActivity.class);
    intent.putExtra(key, "my_value"); //Used to send information to action class
    PendingIntent pi = PendingIntent.getActivity(context, 0, intent,
                                     PendingIntent.FLAG_UPDATE_CURRENT);
    

提交回复
热议问题