Android:如何创建一个“正在进行的"通知? [英] Android: How to create an "Ongoing" notification?

查看:11
本文介绍了Android:如何创建一个“正在进行的"通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我如何创建永久通知,例如电池指示器的第一个通知?

Hello, How do i create the permanent notification like the first one for Battery Indicator?

推荐答案

为您的 Notification 分配 Notification.FLAG_ONGOING_EVENT 标志.

Assign Notification.FLAG_ONGOING_EVENT flag to your Notification.

示例代码:

yourNotification.flags = Notification.FLAG_ONGOING_EVENT;
// Notify...

如果您不熟悉 Notification API,请阅读 在 Android 开发者网站上创建状态栏通知.

If you aren't familiar with the Notification API, read Creating Status Bar Notifications on Android developers website.

这篇关于Android:如何创建一个“正在进行的"通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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