我开发 可以将小部件固定在主屏幕上,它在大多数设备上都可以很好地工作,但与华为和Vivo手机无法使用。
当我通过调用 appWidgetManager.requestpinappwidget()
来调用 appwidgetManager.requestpinappwidget()
时,它将调用 android:configure
代码> AppWidget-Provider 。确认配置后,设置将得到正确保存,但是华为/Vivo Launcher显示错误并且不会加载小部件(并且错误与我的应用无关!)。
我还尝试创建另一个 appwidget-provider
没有 Android:configure
参数,并且它在华为手机上完美工作(但不能在Vivo上工作!)。但是,Android将在启动器的小部件选择屏幕(即小部件拾音器)上显示另一个小部件。如果我使用 android:widgetFeatures = hide_from_picker
它只能从Android API 28+起作用,并且旧设备仍然会看到一个无法配置的“错误”窗口小部件选项(注意:Huawei Phones huawei huawei dimploye dimploy nimploy dimploy nimploy dimploye huawei himo选项,即使它们是API 28+)。
无论如何,我可以修复小部件固定在华为手机,体内手机或行为行为的设备上?
更新:目前,我决定禁用 build.manfucturer.tolowercase()
是“ vivo”
或“ huawei”
是“ vivo”
是“ vivo” 。
更新2:我用和 AppWidgetManager.RequestPinappWidget()
也与华为和Vivo设备一起使用,因此是他们的默认启动器,它是错误的... :(
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... :(
发布评论
评论(1)
这不是问题的解决方案,但是我最终禁用
appwidgetManager.requestpinappwidget()
使用Vivo和Huawei默认启动器的设备功能以下方式:使用此方法检测当前默认启动器是否支持窗口小部件固定:
注意:使用第三方发射器的更多技术精通的用户仍然可以在Huawei和Vivo设备上享受窗口小部件的功能,其余的将不得不添加发射器本身的小部件...
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...