可能使一个Android的通知,不叫的意图是什么? [英] Possible to make an Android Notification that does not call an Intent?

查看:79
本文介绍了可能使一个Android的通知,不叫的意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要把通知中的状态栏,而我的应用程序正在运行,但我不想,如果选择了它回调到我的活动。它的意思仅仅是,该应用程序正在运行的用户信息 - 基本上是一个提醒的情况下,他们preSS home键和最小化

I need to put a Notification in the Status bar while my app is running, but I don't want it to call back to my Activity if selected. Its meant to just be info to the user that the app is running - basically a reminder in case they press the home button and minimize it.

想法?

推荐答案

最后我想出一个解决这个问题,尽管它基本上是一个黑客。而不是我使用一个对话框类的意图,点设置到活动类。

I ended up coming up with a solution to this issue although its basically a hack. instead of setting the intent to point to an Activity class I'm using a Dialog class.

this.notificationIntent = new Intent(this, SomeDialog.class);

现在,如果用户通过选择的logcat通知,我可以看到启动的活动记录下来,但它似乎什么也没有发生。

Now if the user selects the notification, via the logcat, I can see the Starting Activity logged, but it appears nothing happens.

这让我发布一个通知,而我的应用程序正在运行保持,然后我就关闭它,当用户退出。

This allows me to post a notification that stays while my app is running and then I just dismiss it when the user exits.

这篇关于可能使一个Android的通知,不叫的意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆