How to open isolated popup on GCM notification like Viber

泪湿孤枕 提交于 2020-01-03 03:01:31

问题


Generally upon receiving message using Android GCM we call generateNotfication that fires a notification.

I want to know that instead of firing a notification in notification bar, I would like to open an isolated popup window, where user can perform further actions as Viber do.

As for viber, No matter where ever a user is, upon receiving a text message it open a smart popup dialog where you can reply.

Why i call it isolated, because i don't the whole application to launch, just an activity in the form of modal box.

Any help would be highly appreciated.

Thanks


回答1:


I think what you can do it, on receiving a message from GCM, launch a transparent activity and from within the activity, you create and show a dialog inside onCreate(). Then when a user presses Cancel button, you can call finish() to close the Activity . See here: How do I create a transparent Activity on Android? . This way to user it would feel that you have just created a dialog and in actual you would be creating a transparent activity.



来源:https://stackoverflow.com/questions/18747312/how-to-open-isolated-popup-on-gcm-notification-like-viber

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!