android - 编写一个在android中关闭主应用程序时执行的后台程序

标签 android

我正在编写一个 android 应用程序,当用户登录到应用程序时,它与服务器通信。现在,如果用户在没有注销的情况下关闭了应用程序,我想每 15 分钟查询一次服务器,以查看特定用户是否收到了任何更新。如果是,那么我想推送一个通知,点击后用户会直接进入显示更新的应用程序 Activity 。

这如何在android中实现?可能吗?
谁能建议使用计时器的解决方案?请记住,此后台程序应仅在实际应用程序关闭时运行。

最佳答案

您可以为此目的使用服务。看看这个: http://developer.android.com/guide/topics/fundamentals/services.html http://marakana.com/forums/android/examples/60.html http://developer.android.com/guide/topics/ui/notifiers/notifications.html

关于android - 编写一个在android中关闭主应用程序时执行的后台程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9858563/

相关文章:

android - 如何在android中计算设备级别的FPS

android - 内容观察者类的 onchange 函数被多次调用

java - 无法在 jsoup 中使用文档

android - 构建旧版 Android AOSP

android - 我们不应该从 Android Studio 在 GitHub 上提交哪个文件

android - 为什么 0dp 被认为是性能增强?

Android 工作管理器 : How to enqueue Jobs once a month

android - android :windowBackground and android:colorBackground? 之间的区别

android - Xamarin Forms MasterDetail 页面导航导致 Android 崩溃 [致命信号 6 (SIGABRT),代码 -6],适用于 iOS 和 UWP

android - 获取错误 : external allocation too large for this process