在应用里使用了后台服务,并且在通知栏推送了消息,希望点击这个消息回到activity,
结果总是存在好几个同样的activity,就算要返回的activity正在前台,点击消息后也会重新打开一个一样的activity,返回好几次才能退出,
而不能像qq之类的点击通知栏消息回到之前存在的activity,如果存在就不再新建一个activity
说的有点绕,如果是遇到此类问题的肯定能懂,没遇到过的估计看不懂我这混乱的表达了.....
经过查阅资料,通过如下方式解决了,
其实主要功劳就是第10行,
java代码
结果总是存在好几个同样的activity,就算要返回的activity正在前台,点击消息后也会重新打开一个一样的activity,返回好几次才能退出,
而不能像qq之类的点击通知栏消息回到之前存在的activity,如果存在就不再新建一个activity
说的有点绕,如果是遇到此类问题的肯定能懂,没遇到过的估计看不懂我这混乱的表达了.....
经过查阅资料,通过如下方式解决了,
其实主要功劳就是第10行,
java代码