Wednesday 25 May 2011

DEV - App Install Location

Since API level 8 (a.k.a. Froyo), Google introduced the possibility for developers to let users move their applications to the phone external storage. A great opportunity especially for those who do not own a recent device.
Though this technology is a great improvement, it has lots of limitations which I realized they are not so evident...
So let's make a small list of what may not work when your app is installed onto the SD card (taken from the Android Dev Guide).

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.
Live Folders: Your Live Folder will be removed from the home screen. When external storage is remounted, the user can add your Live Folder to the home screen 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.
Copy Protection: Your application cannot be installed to a device's SD card if it uses Android Market's Copy Protection feature. However, if you use Android Market's Application Licensing instead, your application can be installed to internal or external storage, including SD cards.

So all of you developers out there, be sure to check this list whenever you are developing an app which holds one of these features, or you may fall in the same situation I did: I was developing a BroadcastReceiver to start at boot time but my app had been installed on SD card and I lost at least a couple of hours trying to get the Receiver to start after a reboot. Quite disapponting indeed especially because I believed to have done some wrong coding in my app....

No comments:

Post a Comment