I developed an app that can pin widgets to the home screen, it works perfectly on most devices, but not with Huawei and Vivo phones.
When I pin a widget with a Huawei/Vivo device by calling appWidgetManager.requestPinAppWidget()
then it will invoke the configuration screen as defined in the android:configure
field of the appwidget-provider
. Once I confirm the configuration, settings are saved properly, but Huawei/Vivo launcher shows an error and does not load the widget (and the error is not related to my app!).
I also tried to create another appwidget-provider
without the android:configure
parameter, and it works perfectly on Huawei phones (but not working on Vivo!). However, Android will show another widget on the launcher’s widget selection screen (i.e. the widget picker). If I use android:widgetFeatures=hide_from_picker
it will work only from Android API 28+, and older devices will still see a “wrong” widget option that cannot be configured (note: Huawei phones will simply ignore that options, even if they are API 28+).
Any way I can fix the widget pinning on Huawei phones, Vivo phones, or devices that behave like that?
UPDATE: at present I decided to disable the widget pinning feature when Build.MANUFACTURER.toLowerCase()
is either "vivo"
or "huawei"
.
UPDATE 2: I tested with Nova Launcher, and appWidgetManager.requestPinAppWidget()
works perfectly also with Huawei and Vivo devices, thus it is their default Launcher which is buggy... :(
This is not the fix to the issue, but I ended up disabling
appWidgetManager.requestPinAppWidget()
functionality for devices using Vivo and Huawei default launchers in the following way:Use this method to detect if the current default launcher supports or not widget pinning:
Note: more tech-savvy users that use a third-party launcher can still enjoy the widget-pinning feature on Huawei and Vivo devices, the rest will have to add widget(s) from the launcher itself...