添加按钮上面的通知选项卡,在状态栏 [英] Add Buttons Above the Notifications Tab in the Status Bar

查看:179
本文介绍了添加按钮上面的通知选项卡,在状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序,将大多数的时间服务运行。用户将能够通过状态栏来控制它 - 包括完全停止服务的能力。

I am developing an Android app that will run as a service most of the time. The user would be able to control it via the status bar -- including the ability to stop the service altogether.

即使我能够做出一个自定义视图,并把在通知区域按钮[见图1],我希望能够把它的Android/服务提供商的名称上。多,在相同的方式中的音乐播放器应用程序做此[见图2]。这样一来,即使用户清除他们的通知,我的应用程序的控制面板上的服务正在运行仍然有效,只要。

Even though I am able to make a custom view and put buttons on the Notifications area [see Figure 1], I would like to be able to put it above the "Android"/Service Provider's name. Much in the same way as the Music Player app does this [see Figure 2]. That way, even if the user clears their notifications, my app's control panel will remain active as long as the service is running.

什么是做到这一点的最好办法,好吗?

What's the best way to do that, please?

原始图像链接

推荐答案

您已经ROM隐藏在持续头;音乐播放器和硬件控制部件都使用 ONGOING_EVENT 标志留在原地(有人纠正我,如果我错了)。通过加载到您的手机修补您的应用程序确认这一点 - 文档具体的名字,例如音乐播放器(和其他时间你的进程仍在继续的背景下)的时候,你应该使用这个标志。

Your ROM has hidden the Ongoing header; both the Music player and the hardware control widget use the ONGOING_EVENT flag to remain where they are (someone correct me if I'm wrong). Confirm this by loading your app onto your patched phone - the documentation specifically names e.g. Music players (and other times your process is still going on in the background) as times when you should use this flag.

您可能想指出,同一页面推荐的 FLAG_NO_CLEAR 标志 - 如果你想要的是它不被清除,当用户点击明确的通知(此建议正在进行的应用程序)。

You might like to note that the same page recommends the FLAG_NO_CLEAR flag - if all you want is for it not to be cleared when the user clicks clear notifications (this is recommended for ongoing apps).

这篇关于添加按钮上面的通知选项卡,在状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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