更新正在进行的通知悄然 [英] Updating an ongoing notification quietly

查看:115
本文介绍了更新正在进行的通知悄然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有它连接到其他设备进行无线服务。当启用该服务,我有一个持续的通知,其中规定已启用。

I have a service which connects to other devices wirelessly. When the service is enabled, I have an ongoing notification which states it is enabled.

在启用服务时,用户然后连接到其他设备。在这一点上,我想我的更新正在进行通知说明已连接到该设备的名称。这是很容易做到通过调用 startForeground(ONGOING_NOTIFICATION,通知)再次更新的信息;然而,这对闪烁每次调用时间了吧通知。我真的希望是通知在后台悄悄更新而不闪烁的通知栏上,这样用户不知道两者的区别,直到他或她打开通知区域中的样子。

After the service is enabled, the user then connects to another device. At this point, I would like to update my ongoing notification to state the name of the device which has been connected to. This is easy enough to do by calling startForeground(ONGOING_NOTIFICATION, notification) again with the updated information; however this flashes the notification on the bar each time it is called. What I would really like is the notification to quietly update in the background without flashing on the notification bar so the user doesn't know the difference until he or she opens the notification area to look.

有没有天晓得更新通知,而无需调用 startForeground()

Is there someway to update the notification without calling startForeground()?

此行​​为只发生在蜂窝。姜饼设备(和我假设升级Froyo等)的行为所需要的方式。

This behavior only occurs in Honeycomb. Gingerbread devices (and I assume Froyo, etc.) behave the desired way.

推荐答案

您应该更新现有通知<一href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating">http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating

这篇关于更新正在进行的通知悄然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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