问题描述
我的应用程序中有一个小部件,该小部件最初发出POST请求,并在数组中获取一些信息,并将其显示在小部件上.它有两个按钮可用于此信息的上一个和下一个,在我构建应用程序时,它可以完美地工作.
I have a widget from my app that initially makes a POST request and gets some info in an array and displays them on the widget. It has two buttons for going next and previous on this information and it works perfectly when i build the App.
问题是我关闭该应用程序的那一刻,小部件停止工作,按钮什么也没做.
Problem is the moment i close the app the widget stops working, the buttons do nothing.
我不知道该怎么办.
只要我保持我的应用打开状态,该应用即可正常运行,但即使关闭该应用,我也希望它能够正常运行.我该怎么办?
As long as i keep my app opened the app works perfectly but i want it to work even when the app is closed. How can I do that ?
推荐答案
您可以使用在后台运行的与AppWidgetProvider进行通信的服务.请参见以下示例: Widget-Service通信
You could use a Service running in background that communicates with the AppWidgetProvider. See this example: Widget-Service communication
这篇关于窗口小部件停止工作后,我关闭了我的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!