安裝在外接SD卡,Eclipse 設定:
修改 android:installLocation
參數
該參數位於 <manifest>
, 值可以是 "preferExternal
" or "auto
".
位置如下:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
... >
必須在API Level 8以上(The ability for your application to install on the external storage is a feature available only on devices running API Level 8 (Android 2.2) or greater. )
注意下列事項:
-
Include the
android:installLocation
attribute with a value of "auto
" or "preferExternal
" in the<
manifest
>
element.
-
Leave your
android:minSdkVersion
attribute as is (something less than "8") and be certain that your application code uses only APIs compatible with that level.
-
In order to compile your application, change your build target to API Level 8. This is necessary because older Android libraries don't understand the
android:installLocation
attribute and will not compile your application when it's present.
When your application is installed on a device with an API Level lower than 8, the android:installLocation
attribute is ignored and the application is installed on the internal storage.
Caution: Although XML markup such as this will be ignored by older platforms, you must be careful not to use programming APIs introduced in API Level 8 while your minSdkVersion
is less than "8", unless you perform the work necessary to provide backward compatibility in your code.
下列APP 種類不適合安裝在外接記憶卡:
(In order for your application to consistently behave as expected, 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:)
- Services
- Your running
Service
will be killed and will not be restarted when external storage is remounted. You can, however, register for theACTION_EXTERNAL_APPLICATIONS_AVAILABLE
broadcast Intent, which will notify your application when applications installed on external storage have become available to the system again. At which time, you can restart your Service.
- Alarm Services
- Your alarms registered with
AlarmManager
will be cancelled. You must manually re-register any alarms when external storage is remounted.
- Input Method Engines
- Your IME will be replaced by the default IME. When external storage is remounted, the user can open system settings to enable your IME again.
- Live Wallpapers
- Your running Live Wallpaper will be replaced by the default Live Wallpaper. When external storage is remounted, the user can select your Live Wallpaper again.
- 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).
- Account Managers
- Your accounts created with
AccountManager
will disappear until external storage is remounted.
- Sync Adapters
- Your
AbstractThreadedSyncAdapter
and all its sync functionality will not work until external storage is remounted.
- Device Administrators
- Your
DeviceAdminReceiver
and all its admin capabilities will be disabled, which can have unforeseeable consequences for the device functionality, which may persist after external storage is remounted.
- Broadcast Receivers listening for "boot completed"
- The system delivers the
ACTION_BOOT_COMPLETED
broadcast before the external storage is mounted to the device. If your application is installed on the external storage, it can never receive this broadcast.
建議安裝在SD 卡的APP
-
非上述8項app
-
占儲存空間的遊戲app
但是移除SD CARD 會造成遊戲app,關閉,使用者要重新玩
When external storage becomes unavailable and a game process is killed, there should be no visible effect when the storage becomes available again and the user restarts the game (assuming that the game properly saved its state during the normal Activity lifecycle).
留言列表