It seems like it has been a pain for some time (quite a lot of research on SO and on the web)
In a nutshell, the Android documentation is listed:
- onReceive will be called before every other lifecycle method calls
- onDeleted will be called when the widget is deleted
- onDisabled will be called when the last widget is removed
Well, when removing a widget, neither onReceive nor subsequently onDeleted is called. Similarly, when the last widget is removed, the code does not reach the value onDisabled.
1. This was a problem with Android version 1.5 and still remains.
Android developers at Google, what was the reason for not fixing this after more than 10 major releases?
For everyone else ...
Is there any workaround for this, no matter how ugly it is?
Sorry my upset tone.
source share