Search code examples
androidkotlinandroid-widget

Remove App Widget programmatically when its corresponding item is deleted


My App has a recyclerView and each recyclerView Item can have its Widget. The problem is when the user deletes the item of recyclerView its corresponding Widget remains on the Home Screen which is not working anymore. Is there any way to remove App Widget programmatically when a user deletes the item from the App, I have widget ID.


Solution

  • You cannot add or remove app widgets from the home screen. Only the user can do that.

    Any app widgets tied to a deleted account could show a different account, or adopt some "(account deleted)" look that would trigger the user to get rid of the app widget or reconfigure it.