java - 即使应用程序未运行,也会显示警报对话框

标签 java android

我想在我的应用程序的用户收到特殊消息(来 self 的应用程序)时通知他。 即使我的应用程序在后台运行(或者如果可能的话根本不运行),我如何向用户显示某种消息。

我希望通过文字和声音通知他。

谢谢。

最佳答案

您需要写一个service为了这样做。然后在您的服务代码中使用 Notification类来显示文本和声音警报。

关于java - 即使应用程序未运行,也会显示警报对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10804218/

相关文章:

java - 在 maven 中创建并安装 de-lomboked 源 jar

java - 为什么 java Iterable 接口(interface)不能采用泛型通配符?或者 : why can't I an overriding iterator() method return an Iterator for a subclass?

android - 如何定义网站屏幕快捷图标?

android - 在 Android 中获取位置更新

java - 操作对象、构造函数?

java - 如何在路径名中有空格的java中执行命令

java - 枚举和字符串之间的映射?

javascript - 未捕获的类型错误 : Object #<Object> has no method 'exec' at file:///android_asset/www/index. html

android - float 操作按钮出现在抽屉导航上方

android - 如何使用 CursorLoader 进行多个串行数据库查询