如何安全地编程方式删除SD卡上的Andr​​oid [英] How to safely remove SD card programmatically on Android

查看:106
本文介绍了如何安全地编程方式删除SD卡上的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,让用户安全地在我的计划中删除SD卡,但似乎对Android 2.2的公共API并没有提供一种方式来做到这一点。没有人知道什么是正确的方式做到这一点?

I want to let the user safely remove the SD card in my program, but it seems the Android 2.2 public API does not provide a way to do this. Does anyone know what's a proper way to do it?

推荐答案

您需要把用户对设备的内置设置。我认为这会工作。

You need to take the user to the device's built-in Settings. I think this will work.

    Intent i = new Intent(android.provider.Settings.ACTION_MEMORY_CARD_SETTINGS);
    startActivity(i);

卸载SD卡是能够被恶意利用,如果不是完全由用户控制的操作之一。如果它可以完全由软件来完成(无需用户干预),那么code可能会破坏该设备上运行的其他应用程序。

Unmounting the SD card is one of those actions which could be used maliciously if it wasn't under full user control. If it could be done purely in software (without user intervention) then code could disrupt other apps running on the device.

这篇关于如何安全地编程方式删除SD卡上的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆