Android;Force AppWidget to work from SD Card?

无人久伴 提交于 2020-01-02 08:34:41

问题


Is there any way to force AppWidget to work even App is moved to the SD Card and SD Card is not unmounted? Docs say:

... you should not allow your application to be installed on the external storage if it uses any of the following features, due to the cited consequences when the external storage is unmounted:
...
App Widgets
Your App Widget will be removed from the home screen. When external storage is remounted, your App Widget will not be available for the user to select until the system resets the home application (usually not until a system reboot).

It seems that docs say AppWidget will be removed from home screen if user unmounts SD Card.But When I move the App in emulator to the SD Card (and I do not unmount SD Card) see problem loading widget message in Home Screen,also the widget is not available for user in list of widgets.Why?


回答1:


For now, there is no way to make a Widget to work while the app is installed on the SD-Card. This is the normal behavior even when SD-Card is mounted.

You get the error problem loading widget because Widgets are automatically disabled (and removed from the Widget list, so you can't add them) when you move the app to external storage, but they are kept in Home Screen, to be ready when you move it back to the phone and home application is resetted.

If you're going to support that the user move your app to external storage, maybe you can publish another app to only hold your widgets, and configure it so that it can only by installed in the phone. This solves the problem but the user has to download two apps instead of one.



来源:https://stackoverflow.com/questions/18398683/androidforce-appwidget-to-work-from-sd-card

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!