Thursday, 20 February 2014

Signing Phonegap's Android Applications and Deploying on Google Play

The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer.

before submit release on google play your application must be build in release mode.


Signing in Release Mode:

When your application is ready for release to other users, you must:

    1-Obtain a suitable private key
    2-Compile the application in release mode
    3-Sign your application with your private key
  
Generating private Key:

 To generate a self-signed key with Keytool.Keytool is java tool for generating private key. use following command to generate private key for signing your android application:

keytool -genkey -v -keystore app_signing.keystore -alias <alias_name> -keyalg <alg> -keysize <size> -validity 10000

where:

-genkey : Generate a key pair (public and private keys).

-v          : Enable verbose output.

app_signing: name of your key_file.

-alias    :  An alias for the key. Only the first 8 characters of the alias are used.

-keyalg <alg>:    The encryption algorithm to use when generating the key. Both DSA and RSA are supported.




 -keysize <size>:    The size of each generated key (bits). If not supplied, Keytool uses a default key size of 1024 bits. In general, we recommend using a key size of 2048 bits or higher.

-validity <valdays> :  The validity period for the key, in days.A value of 10000 or greater is recommended.

==================================================

Note: during creation of private key system ask for storeKey password,give any password and remember that password.it will required when you build the application in release mode.




----------------------------------------------------------------------------------------------------------------------------------
Building application for release:
1- after creating the signing key you have to add the key.keystore  file in your profile on https://build.phonegap.com/.
 
2- upload application.zip folder(compressed file of your application's www folder).

3- unlock your private key by your storekey password.

4- build your application.

--------------------------------------------------------------------------------------------------------------------------------

if you download your build app.apk from https://build.phonegap.com/
you can see that it is a app-release.apk.this build is signed build and you can just upload it on google play.


















No comments:

Post a Comment