android-ondestroy

Get Intent passed to stopService(intent) in Service

人走茶凉 提交于 2019-12-25 18:33:58
问题 I have a requirement to detect source of destroying service. I am using intent and extra while calling stopService(intent). But where to catch this intent in Service class to act upon. Already gone through android docs, nothing helpful found. Any help is highly appreciated. 回答1: Now, I believe Mark Murphy when he said it isn't possible. As an alternative, you can register a BroadcastReceiver in your Service for stopping the service and then send broadcast to this receiver from all over your

Widget not working after Force quit App

僤鯓⒐⒋嵵緔 提交于 2019-12-24 03:50:41
问题 I have a widget that works well in all cases except when the app is forced quit. When that happens, any touch or button press on the widget is not working. However, when the app is launched again, the widget works again. Even if I kill the app (by swiping it), the widget still works. My systematic control over the widget is through remoteViews. Do I need to something to handle this case? My guess is that it has to do with onDestroy(). Thanks! Note: it is similar but not a duplicate of Widget