问题
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