Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
485 views
in Technique[技术] by (71.8m points)

android - Removing Widget from Home Screen when Uninstalled

When my application is uninstalled, a widget that is contained in this packages stays on the HOME screen and gives an error message "problem loading widget".

How do I remove the widget when my application is uninstalled? Is there an attribute in the manifest that I am missing?

I thought this thing should be handled by the OS, but guess it is not.

EDITED: I am now catching the "PACKAGE_ REMOVED" intent, and checking the "EXTRA_REPLACING" to make sure it's not a reinstall, but I don't know the actual code to use to actually remove the widget.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Quoting @CommonsWare #4532121


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...