Android app Widget update new version removes the existing widget - android

I developed an APP + Home screen widget for Android. Now I updated the app (incremented the version code/name) but when i install, it doesn't automatically replaces the existing widget on screen. It just says "problem loading widget".
Any Idea??

Did you change the class name of the broadcast receiver implementing your widget? If so, don't do that.

There is of course the related use-case where there was a widget loaded on the home page and the user then uninstalls the application that contains the widget and widget config app. I guess this is the same as a new version which must to an uninstall/install cycle.
When that happens, all you see is the "Problem Loading Widget" in a toast-like box on the home screen. As far as I can tell, the widget gets no indicatation that the package is being uninstalled and I guess then the home screen AppWidgetManager thows up a default message.
Not well thought out behaviour on the part of the OS team. I suggest that it would be better to call the widget's onDisbled() and onDestroy() methods and to remove the widgets from the home screen before the package is removed so they can tidy up if need be and the user (non-geek phone user) gets a clean experience.
All I can find is the indication that only the user can remove a widget from the home screen, says commonsguy: Removing AppWidgets programmatically
I sure us developers can handle the odd weird toast, but for non technical "ordinary" phone users this sort of behaviour drives them back to iPhones very quickly.

This is the right behavior to me. As app is installed again, its widgets should be installed again too. If, for instance, there is a new activity to configure the widget, how do you know it as a user ?
There is, indeed, no way to guarantee that a new widget would run at all from this perspective.

Related

Android Appwidget not showing in launcher after installation

Q. Android Appwidget not showing in launcher immediately after installation:-
What I have already tried and does not work consistently
Included stub Activity with MAIN and LAUNCHER intent filter
Included this code in onCreate() of this stub activity
sendBroadcast(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
What works consistently
Reboot
Change orientation of device with widget list opened. This causes a refresh of the widget list and shows the newly installed widget.
So is there something I am missing ? It creates poor perception when user installs widget and does not find the widget in the widget list. Generally leads to uninstall :(
This is an open issue for some devices and OS versions (mainly ICS it seems). What are you running? It should be the same issue which is, hopefully, soon fixed. I think the best option for you would be to inform your customers about this bug and that it is out of your hands. You should then also provide an easy way to fix it! An informed customer is less likely to have false expectations and uninstall your widget.

android access widget list, coax/remind users to install widget

I would like users to install the widget component of my app. Currently my "mainactivity" simply pops up a textview saying that there is a widget and to see their widget list.
Unfortunately right now, this requires them to open the mainactivity at all. If they want to see the widget in their list of widgets.
I don't want to do anything annoying, but there does seems like there are a lot of hurdles to actually getting and using a widget right now.
Things I could do: setup an onboot service that checks to see if the widget is on the launcher screen. It could remind users once or twice (ever) via some kind of notification. The widget can turn off that service using its onUpdate method or other lifecycle commands. I personally hate erroneous notifications.
One thing I'd like to do is programmatically open up the widgets list. is that possible? any other best practices? Since we can't have widget only apps anymore, I'd still like the main component of my app to be a widget.
setup an onboot service that checks to see if the widget is on the launcher screen
That will require the user to launch your activity, anyway, on Android 3.1+. Your "onboot service" will not run before then.
One thing I'd like to do is programmatically open up the widgets list. is that possible?
No. After all, the user has to indicate where on the home screen the app widget goes first.
any other best practices?
An app that is purely an app widget, unless it is blindingly obvious that it is only an app widget, is going to have these sorts of issues. That is why many app widgets are simply one piece of a more substantial app, so that if the user elects not to use your app widget, or does not notice that it is there, it is not that big of a deal.

Android remove widget on app uninstall

I have a problem with a widget I have for an application.
If I put the widget on my homescreen, then I uninstall the application that my widget comes from, but the widget will not be removed on the homescreen. Instead of the widget there is a text saying: : "Loading".
Are there some kind of code I need to write so it gets removed when I uninstall the application on the phone?
I'm pretty sure the user has to manually remove widgets from the home screen. Here is a reference
You should package your widget and your app in the same APK. Then, when you uninstall the app, the widget will automagically get removed.
EDIT Unfortunately, I should have tested this before I posted. This does NOT work. You cannot programmatically remove the widget when the app is uninstalled. see this and this. 1000 Apologies for my incorrect advice :-(

Remote service clean up, launcher screen refresh required

the problem is that once a widget of my application is uninstalled, it lkeaves a black message box on the home screen saying unable to load widget, i was wonderring if we could clean the system display our self, is it possbile to add some code/ call to instruct the android frame work to do that, the widget is being consumed by a remote service may be once service is finished/closed we can call some syetem calls, any code for helping out the home reloading will help, Thanks
There is nothing for you to do. The user and the home screen will take care of this.

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.
You cannot add or remove app widgets from the home screen. Only the user can do that.
Quoting #CommonsWare #4532121

Categories

Resources