简体   繁体   English

通知像Android中的viber一样在主屏幕中弹出

[英]Notification pop up in home screen like viber in android

I want show Viber like home screen pop up when Push notification received by my application, I google it but did not get the answer. 当我的应用程序接收到“推送”通知时,我想像主屏幕一样弹出Viber,我用google搜索但没有得到答案。 My requirement is like this How to implement 'pop up box' in Android similar to Viber (when a message is received) 我的要求是这样的如何在Android中实现类似于Viber的“弹出框”(收到消息时)

Here I am answering to question as I got solution. 当我得到解决方案时,我在这里回答问题。

In GCMIntentService Class 在GCMIntentService类别中

while creating intent add the following code to show the Intent as Viber does. 在创建Intent时,请添加以下代码,以与Viber一样显示Intent。

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.getApplicationContext().startActivity(intent);

This will show the intent immediately irrespective to the App State. 这将立即显示意图,而与应用程序状态无关。 Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM