Android - Build a notification, TaskStackBuilder.addParentStack not working

前端 未结 11 2613
说谎
说谎 2020-11-28 06:23

I\'m trying to launch an activity from a notification like the Android docs explain, but when I open the notification and then press the back button, the HomeActivity (paren

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 06:32

    I had the same problem! Solve:

    switch to

    PendingIntent resultPendingIntent = 
    
    PendingIntent.getActivity( this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    
    PendingIntent resultPendingIntent = 
    
    stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
    

提交回复
热议问题