Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PendingIntent可能出现push消息打开重建activity的问题 #6

Open
zi6xuan opened this issue Apr 3, 2018 · 0 comments
Open

Comments

@zi6xuan
Copy link
Owner

zi6xuan commented Apr 3, 2018

TaskStackBuilder stackBuilder = TaskStackBuilder.create(con);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
stackBuilder.getPendingIntent...

这样的模式为了创建完整的Activity队列,可能导致并不会调用已经存在的activity,而是重新创建,要想push消息等只调起已经存在的activity不要重新创建需要下面这样写:
PendingIntent resultPendingIntent = PendingIntent.getActivity(con, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent.FLAG_UPDATE_CURRENT比较关键,如果不设置此值,会导致Intent消息不会更新到当前activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant