Now that our app is finally finished, we can get started creating the final app package. We need to ensure that the actual package meets Google Play's requirements and is signed with a key from a keystore.
Before we can create the app package, we need to ensure that the package will be accepted by Google Play and the metadata describes the app correctly. To do this, we use the app's project settings to provide the correct values for the packaging process:
[Application]
attribute:[assembly: Application(Icon = "@drawable/iconit is just an alternati")]
AndroidManifest.xml
file, using the project options:Now that the package is ready to be created, we can switch to the release configuration and start the build process:
Once an app's code is complete and the various compiler options have been set, we will create the final package that will be uploaded to Google Play. Just before we build the package, we need to first check that the packaging options are correct for this release of the app. These options are used to display and categorize the app of both the device as well as Google Play.
The first option is the Application name, which is used as the title for the app on Google Play. Once the app is installed, the name that appears on the launcher will actually be the name of the activity. In the same way, the Application icon option is also only used on Google Play, and the activity icon used on the device launcher. As these two fields are user-visible resources, they should be localized. The Application name field can be a plain string, but this is not recommended.
The Package name field is really the ID that is used to identify our app on Google Play. This has to be unique across the entire store and cannot be changed once the app has been published. As a result, it is important that we select a name that will remain relevant throughout our app's lifetime.
The next important part of the package is the version. Versioning consists of the internal, integer number representing our app's version. Every release must receive a higher number, and this is used by Google Play to determine whether the app needs to be updated on the user's device.
The other component to the version, is the user-friendly Version name. This can be any string that we want to present to the user, and it is not used by Google Play. Usually, this is in the form <major>.<minor>.<point>
, or in the case of .NET versioning, <major>.<minor>.<build>.<revision>
.
The last packaging option to set, is the install location. Here, we specify where to try and install to. We can request that we install to the external storage, or specify that we must always, and only, install to the internal storage. If the app is quite large, we should prefer the external storage.
When we want to actually create the app package, that is, the .APK
file that we upload to Google Play, we must build the release configuration. When using Xamarin Studio, we must archive the app before signing the package for distribution. In Visual Studio, we do both steps when we publish the app.
When signing, we use a key, or certificate, from a keystore. This key is used by Android to verify the author of the app. We can reuse an existing keystore, or we can create a new one in the wizard. However, we must use a keystore that only expires after October 22, 2033.
All versions of the same app must be signed with the same key, otherwise Google Play can't verify that the app update was created by the same author. A new key will make it necessary for us to create a totally new app with a new package name. Although not required for many apps, only those signed with the same key can run in the same process and share code.
Maintaining the security of our keystore is of critical importance, both for us as developers and for the user. The keys can be used to impersonate the publisher and access users' private data.
The keystore is required for signing all future versions of our app. If we lose or misplace our keystore, we will not be able to publish updates to our existing app. This is because we cannot regenerate a previously generated key.