Widget stops working atfter I close my app

余生颓废 提交于 2019-12-11 18:58:23

问题


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.

I have no idea what to do.

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 ?


回答1:


You could use a Service running in background that communicates with the AppWidgetProvider. See this example: Widget-Service communication



来源:https://stackoverflow.com/questions/25509025/widget-stops-working-atfter-i-close-my-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!