Tuesday, February 12, 2013

Things That Cannot Change



Sometimes a developer will make a change to an application that has surprising results when installed as and update to a previous version - shortcuts break,widgets disappear, or it can't even be installed at all. 

There are certain parts in application that are immutable once you publish it, and you can avoid surprises by understanding them.

1. Your package name and certificate.


  • Once you publish your application under its manifest package name, this is the unique identity of the application forever.
  • The Signing certificate represents the author of the application.If you change the certificate an application signed with, it is now a different application because if comes with new author.

The exact behavior the user sees when installing an application that has changed in one of these two ways is different:

  • If the Manifest package name has changed, the new application will be installed alongside the old application, so thy both co-exist on the user device at the same time.
  • If the signing certificate changes, trying to install the new application on to the device will fail until the old version the uninstalled.

2. Your AndroidManifest.xml is a public API:

  • A major function of the AndroidManifest.xml is essentially to declare a public API from your application for use by other applications and the Android system.
  • Every component you declare in the manifest that is not private ( android:exported="true" - public, android:exported="false" - private) should be treated as a public API .
  • We think android:name attribute of your activity,service and receiver components as pointing to your private code implementing your application, but it is also the official unique public name for that component.

Change the component name inside of an application can have negative consequences for your users.

  • If the name of the main activity of your application is changed - short cuts will no longer work.
  • If the name of a service implementing a live wallpaper changes - then the users who enabled your Live wallpaper will have there wallpaper reverted to system default.
  • If the name of a receiver implementing a Device Admin changes - It will be disabled, this will effect all the other kinds of receiver, such as app widgets. 
These behaviors are an outcome of how the Intent system is used on Android.

No comments:

Post a Comment