如何安全地编程方式删除SD卡上的Andr​​oid卡上、方式、安全、SD

2023-09-06 09:22:34 作者:不如两两相望°

我想,让用户安全地在我的计划中删除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.

 
精彩推荐
图片推荐