auto和preferExternal安装位置Android清单之间的区别

Sli*_* C. 5 android location install manifest

android清单autopreferExternal安装位置有什么区别?两个选项都可以在外部存储器上安装应用 它是大而重要的吗?设置哪个更好?

The*_*der 17

如Android Api指南中所述,

Beginning with API Level 8, you can allow your application to be installed on the external storage (for example, the device's SD card). This is an optional feature you can declare for your application with the android:installLocation manifest attribute. If you do not declare this attribute, your application will be installed on the internal storage only and it cannot be moved to the external storage.

我相信最好宣布android:installLocation因为,

  • 某些设备的内部存储受限.
  • 用户可以选择在内部存储和外部存储之间移动应用程序.

该属性android:installLocation可以具有以下可能的值.

"internalOnly":应用程序必须仅安装在内部设备存储上.如果设置了此项,则永远不会在外部存储上安装应用程序.如果内部存储已满,则系统将不会安装该应用程序.如果您没有定义,这也是默认行为android:installLocation.

"auto":应用程序可能安装在外部存储器上,但系统默认情况下会将应用程序安装在内部存储器上.如果内部存储已满,则系统会将其安装在外部存储上.安装后,用户可以通过系统设置将应用程序移动到内部或外部存储.

"preferExternal":应用程序更喜欢安装在外部存储(SD卡)上.无法保证系统会遵守此请求.如果外部介质不可用或已满,或者应用程序使用前向锁定机制(外部存储不支持),则应用程序可能安装在内部存储上.安装后,用户可以通过系统设置将应用程序移动到内部或外部存储.


Spr*_*ker 1

如果您声明preferExternal,则表示您请求将您的应用程序安装在外部存储上,但系统不保证您的应用程序一定会安装在外部存储上。如果外部存储已满,系统会将其安装到内部存储上。

如果您声明auto,则表示您的应用程序可以安装在外部存储上,但您没有安装位置的偏好。系统将根据几个因素决定在哪里安装您的应用程序。用户还可以在两个位置之间移动您的应用程序。

参考 http://developer.android.com/guide/topics/data/install-location.html