Sabtu, 10 Juli 2010

Apps on SD Card: The Details

[This post is by Suchi Amalapurapu, an engineer who worked upon this feature. Tim Bray]

Android 2.2 supports duplicate designation upon outmost storage inclination similar to a SD card. This should give users room for many some-more apps, as well as will additionally good certain categories, similar to games, which need outrageous assets.

(Note which not all of a essence of an SD-card-resident APK have been actually upon a card; a dex files, in isolation interpretation directories, as well as local shared libraries sojourn in inner storage.)

The Manage Applications shade in a Settings app right away has an On SD Card tab. The sizes listed in Manage Applications usually include a space taken by a duplicate upon inner storage.

The Application Info shade right away has possibly a move to SD label or move to phone button, but this is often disabled. Copy-protected apps as well as updates to complement apps cant be altered to a SD card, nor can those which have been dont specify which they work upon a SD card.

Controlling Installation Preference

SD-card designation is an optional feature upon Android 2.2, is under a carry out of a developer not a user, as well as will not start any applications built before to Android 2.2.

Application developers can set a field android:installLocation in a base manifest element to a single of these values:

  • internalOnly: Install a duplicate upon inner storage only. This will outcome in storage errors if a device runs low upon inner storage.

  • preferExternal: The android complement tries to implement a duplicate upon outmost storage. If which is full, a duplicate is commissioned upon inner storage.

  • auto: Let a Android complement decide a best implement place for a application. The default complement process is to implement a duplicate upon inner storage first. If a complement is using low upon storage, a duplicate is then commissioned upon outmost storage.

If a installLocation is not specified (as is a case for all applications before to Android 2.2), a duplicate is commissioned upon inner storage. Application updates will by default try to keep their implement location, but duplicate developers might change a installLocation field in an update. Installing an duplicate with this brand brand brand new charge upon comparison inclination will not mangle compatibility as well as these applications will be commissioned upon inner storage only.

Application developers can additionally categorically implement under-development code upon outmost storage around adb implement flags, which override a installLocation field: -f for inner storage, as well as -s for outmost storage. They can additionally override a default implement place to determine as well as exam duplicate designation upon SD label with an adb bombard pm command:

adb bombard pm setInstallLocation option

Where choice is a single of:

  • 0 [auto] Let a complement decide.

  • 1 [internal only]

  • 2 [external]

The stream implement place can be retrieved viaadb bombard pm getInstallLocationNote which becoming different this default can cause applications to mess around if theyre not rebuilt to live upon a SD card.

USB Mass Storage interactions

The Android complement stores a SD-card-resident applications APKs in a secure application-specific container. A brand brand brand new flag FLAG_EXTERNAL_STORAGE in ApplicationInfo vigilant indicates which an duplicate is now commissioned upon a SD card. This storage is private when an SD-card-resident app is uninstalled.

When an Android inclination SD label is unmounted, applications commissioned upon it have been no longer available. Their inner storage is still there as well as such apps can be uninstalled without replacing a SD card.

The Android framework provides multiform promote intents to support a (small) class of applications, such as launchers, which access other applications resources:

  • When a SD label is unmounted, ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE with a list of a infirm applications as well as a list of corresponding duplicate uids around additional attributes in a promote intent.

  • When a SD label is mounted, ACTION_EXTERNAL_APPLICATIONS_AVAILABLE with a list of enabled applications as well as a list of corresponding duplicate uids around additional attributes in a promote intent.

Applications which hoop promote intents similar to ACTION_PACKAGE_ADDED, ACTION_PACKAGE_REMOVED might additionally want to hoop these additional notifications.

When an duplicate gets altered between inner to outmost storage as well as vice versa, a duplicate is infirm initial (which includes report vigilant ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE), a asset resources have been copied, as well as then a duplicate is enabled (which includes report vigilant ACTION_EXTERNAL_APPLICATIONS_AVAILABLE).

Security as well as Performance Implications

Applications upon SD label have been mounted around Linuxs loopback interface as well as encrypted around a device-specific key, so they cannot be decrypted upon any other device. Note which this is confidence measure as well as does not provide duplicate protection; a apps have been world readable only similar to a resources of normal applications commissioned upon a inclination inner storage. Copy-protected applications cannot be commissioned upon outmost media. In a interests of stability, updates to complement applications additionally cannot be commissioned upon a outmost media. The duplicate resources stored upon outmost storage have been read-only as well as as a result there have been no opening issues with loading or launching applications upon SD card.

Swapping or Transferring SD Card Contents

It has always been a case which when we barter SD cards upon an Android device, if we physically duplicate a essence of a aged label to a brand brand brand new one, a complement will make use of a interpretation upon a brand brand brand new label as if zero had changed. This is additionally loyal of apps which have been commissioned upon a SD card.

When not to implement upon SD card?

The value of installing upon SD label is easy to understand: row for storage space is reduced. There have been costs, a most obvious being which your app is infirm when a SD label is possibly private or in USB Mass Storage mode; this includes using Services, not only interactive Activities. Aside from this, device dismissal disables an applications Widgets, Input methods, Account Managers, Device administrators, Live wallpapers, as well as Live folders, as well as might need explicit user action to re-enable them.


National Car Rental

Tidak ada komentar:

Posting Komentar