Android 即使在用户明确停止进程后后台处理(长按主页按钮并删除所有最近使用的应用程序)
Android Background processing even after process has stopped explicitly by user (Long pressing home button and deleting all recent apps)
我是 android 的新手。我正在创建文件共享应用程序。当用户 1 向用户 2 请求文件时,用户 2 将收到通知并执行进一步的上传和下载过程。
问题:
我怎样才能实现这样的任务来跟踪有人请求的文件?我已经创建了数据库,当有人要求文件时,将在其中完成输入。但是 android 设备如何不断检查该条目?
我想要 gmail 使用的这种机制,每次都检查电子邮件。当邮件到来时,它会显示通知。
请帮我创建这样一个后台处理。任何帮助表示赞赏。提前致谢。
我认为您正在寻找的是服务。
A Service is an application component that can perform long-running
operations in the background, and it does not provide a user
interface. Another application component can start a service, and it
continues to run in the background even if the user switches to
another application. Additionally, a component can bind to a service
to interact with it and even perform interprocess communication (IPC).
For example, a service can handle network transactions, play music,
perform file I/O, or interact with a content provider, all from the
background.
阅读有关服务的更多信息here
我得到了答案。我将不得不使用 Google FCM 推送通知。我以前对此一无所知。最后我找到了解决方案。感谢帮助..
我是 android 的新手。我正在创建文件共享应用程序。当用户 1 向用户 2 请求文件时,用户 2 将收到通知并执行进一步的上传和下载过程。
问题: 我怎样才能实现这样的任务来跟踪有人请求的文件?我已经创建了数据库,当有人要求文件时,将在其中完成输入。但是 android 设备如何不断检查该条目?
我想要 gmail 使用的这种机制,每次都检查电子邮件。当邮件到来时,它会显示通知。
请帮我创建这样一个后台处理。任何帮助表示赞赏。提前致谢。
我认为您正在寻找的是服务。
A Service is an application component that can perform long-running operations in the background, and it does not provide a user interface. Another application component can start a service, and it continues to run in the background even if the user switches to another application. Additionally, a component can bind to a service to interact with it and even perform interprocess communication (IPC). For example, a service can handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.
阅读有关服务的更多信息here
我得到了答案。我将不得不使用 Google FCM 推送通知。我以前对此一无所知。最后我找到了解决方案。感谢帮助..