从仅充电更改为磁盘驱动器后 UI 崩溃?

发布于 2024-12-09 18:00:27 字数 419 浏览 0 评论 0原文

似乎应用程序(或者可能只是我的应用程序)具有以下所需权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

偶尔往往会导致 UI 崩溃,例如,当您正在运行该应用程序,然后决定从“仅限充电”切换时到磁盘驱动器。另一件事是,当用户处于磁盘驱动器模式时,该应用程序对用户不可用。您收到消息:“您的手机上不再安装链接的程序”。

有没有办法以编程方式缓解这个问题。也许,通过检查用户何时处于磁盘驱动器模式,这应该触发删除权限或类似的操作。这可能吗?

It seems that apps, or maybe it's just my app, that have the following required permissions:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

tend to occasionally crash the UI when for example you're running the app and then you decide to switch from Charge Only to Disk Drive. The other thing is that the app becomes unavailable to the user when the user is on Disk Drive mode. You get the message : "The Linked program is no longer installed on your phone".

Is there a way to mitigate this issue, programmatically. Maybe, by checking when the user is on Disk Drive mode which should trigger the removal of the permissions or something similar. Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

污味仙女 2024-12-16 18:00:27

您是否使用光标适配器/内容提供程序组合?当外部存储被卸载/安装时,您应该能够获得广播,并且您可以编写一些后备代码。您是否将应用程序安装在 SDCARD 上?

http://android-developers.blogspot。 com/2010/07/apps-on-sd-card-details.html

SD卡就绪的 Android Intent

看看这些链接是否有帮助。

Are you using a cursor adapter/content provider combination? You should be able to get broadcasts when the external storage is unmounted/mounted, and you could write some fall-back code. Are you installing your app on SDCARD?

http://android-developers.blogspot.com/2010/07/apps-on-sd-card-details.html

android intent for sdcard ready

See if these links help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文