8 Jan 2014

Signing an Android Application for Real Life Mobile Device Usage / Installation

If you want to publish an Android application you first need to write it :)


The result of your programming will be an .APK file which is the actual program binary of your application. However, the .APK file your compiler creates can only be used with the emulator on your desktop PC or Mac. You cannot use the same .APK file to install and run your app on your Android phone (like the G1, Kogan Agora, or else).
Why is that? Well, Google wants to protect its phone users from installing and running fraudulent software on their devices. Therefore, each and every application needs to be signed with a valid certificate that ensures where the application comes from. Meaning: the developer (you!) signs the application with his/her certificate to make sure it is always traceable where the application comes from. There are a bunch of more reasons to this so lets check out what Google is saying about this topic:
The important points to understand about signing Android applications are:
  • All applications must be signed. The system will not install an application that is not signed.
  • You can use self-signed certificates to sign your applications. No certificate authority is needed.
  • When you are ready to publish your application, you must sign it with a suitable private key. You can not publish an application that is signed with the default key generated by the SDK tools.
  • The system tests a signer certificate’s expiration date only at install time. If an application’s signer certificate expires after the application is installed, the application will continue to function normally.
  • You can use standard tools — Keytool and Jarsigner — to generate keys and sign your application .apk files.
3 Easy Steps for getting what you need to sign Applications
(this needs to be done once only)
  1. Create a keystore with your own keys and certificates
    First of all you need to create a keystore which stores your certificate. A certificate is always created by the developer himself without any interaction from Google. This actually means that Google does not approve certificates before you can use them for signing your application. (Note: other companies like RIM, Nokia/Symbian, Windows Mobile do such things.)

    Once you installed a Java SDK you can use the default keytoolapplication to create your own keystore. A Java SDK is installed by default on Mac OS X machines and can also be installated additionally on your Windows PC or Linux machine. If you have Java SDK running on your system just go to any prompt and type in the following:
    Windows: START»Command
    $ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

    Windows: Mac: Terminal
    $ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

    You will be asked to enter a password for your keystore. Choose itwisely and remember it! You will need it every time you sign an APK file. Follow the instructions and finalize the creation of your keystore.
  2. Place the keys at a location that makes sense
    Choosing the right place for your keystore is quite important. Let’s imagine you write more than one application so it would not make that much sense to put this keystore into the project directory of the application you are currently working with. As I am using Mac OS X Leopard and Eclipse I got a project directory like/Users/YOUR_NAME/Documents/workspace/DialANumber. However, as mentioned before a more global approach might make so I copied the keystore to the directory:

    /Users/YOUR_NAME/Documents/workspace/androidkeys
    So we got our keystore prepared for signing now.
  3. Write a short script to make your life easier
    Just to make the life easier I wrote a short script which can be used each time to sign your Android APK file.
Once you have done this we are ready for signing our application!
3 Easy Steps for getting your Application signed
(this needs to be done each time you build a binary that is going to be published)
  1. Build your applicationRight click your Android project in Eclipse and select Android Tools » Export Unsigned Application Package.... Follow the instructions and remember the directory your placed the .APK file at. E.g. cd /Users/YOUR_NAME/Documents/workspace/DialANumber/deploy/
  2. Go to your keystore & script directorycd /Users/YOUR_NAME/Documents/workspace/androidkeys/
  3. Sign your application
    In your androidkeys directory you need to execute:

    ./sign-mac-example.sh ../DialANumber/deploy/DialANumber.apk
    Enter passphrase:

    After you entered your passphrase the application should be signed.
You can now upload your app to your server and install it on an Android phone or you can even publish it on the Android Market!
Sources:
P.S.: The complete signing process (the part you need to do each time you sign an app) could be integrated better into Eclipse. I hope Google improves this in future. They could add an entry like Android Tools » Export Signed Application Package... so the developer just needs to enter the passphrase in a GUI dialog. This would make everyone’s life much easier. Perhaps a bored Eclipse PlugIn developer might want to write a plugin for this? It would make many people happy I guess :)

6 Jan 2014

Best Android Phones in India

High-end Android smartphones in India:

Samsung Galaxy S II: There is no second-thought about the fact that there is no other smartphone of this caliber currently in Indian market or will be launched in couple of weeks. So, if you have money and you want a seriously powerful Android smartphone – Galaxy S II is your baby. It will be on sale from June 9/10 in all major stores.
MRP:  INR 32,890 | Street Price: INR 30,500 (expected)
LG Optimus 2X: This is the only dual core Android smartphone available in Indian market right now, although Samsung has announced that Galaxy S2 will reach sometime in May, but till then Optimus 2X is your best bet. With company’s confirmation regarding the Gingerbread update for the device, this dual core beauty is a must have if you are looking for a performance giant.
Optimus 2X features a 4 inch display, 1 GHz dual core nVIDIA Tegra 2 processor,  Android 2.2, 8 MP camera, 512 MB RAM, 8GB internal storage & Expandable external storage of upto 32GB.
MRP: INR 30,000
HTC Desire S: HTC recently started selling Desire S in Indian Market, powered by Gingerbread it is one of the few devices with Android’s latest smartphone OS version in the country. Although it does not possess the rocking specs as Optimus 2X, it does come with some pretty decent internals at its price.
HTC Desire S features HTC Sense, 1GHz Snapdragon MSM8255 processor, dual front and back cameras, and 3.7-inch WVGA display.
MRP: INR 25,490
Sony Ericsson Xperia Arc: It is an absolute beauty, by far the best Android smartphone in term of the looks. Don’t worry, it’s not just the looks, it does come with solid internals to give you nice performance.
Sony Ericsson Xperia Arc features 4.2 inch multi-touch screen, 8.1 MP camera with HD video recording, Android 2.3, 1500mAh battery, and 1 Ghz Qualcomm processor.
MRP: INR 30,000
Nexus S: Manufactured by Samsung in partnership with Google, Nexus S is a great device for anyone who wants to experience true Android. Its software aspects are all as per Google’s instructions, so it will always be the first device to receive Android update until the next Nexus phone launches in the market.
Nexus S features Android 2.3, NFC hardware, 1 GHz processor, 5MP rear camera with front VGA cam, 512 MB RAM, 16GB internal memory
MRP: INR 30,400
Other choices in the segment: HTC Incredible S, Samsung Galaxy S, Dell Venue, LG Optimus Black, Sony Ericsson Xperia Play, HTC Desire HD, HTC Desire Z
Mid-Range Android smartphones in India:
Motorola Defy: This rugged Android smartphone from Motorola is one of best mid-range Android smartphone available in India. There is one small catch here in the form of Android version, Motorola ship it with Android 2.1 with FroYo update scheduled for sometime this quarter. But considering the Motorola’s record with Android updates, I would not suggest this to anyone who wants latest Android version.
Defy features Android 2.1, 3.7-inch touchscreen, 5-megapixel camera with autofocus, flash and OMAP 3610 chip running at 800MHz.
MRP: INR 18,000
Samsung Galaxy SL: A variant of popular Galaxy S, Galaxy SL leaves out Super AMOLED to sport Super Clear LCD. While the specs are pretty much in line with original Galaxy S, SL comes at a much lower price and is a solid device for anyone looking for best Android smartphone below 20K.
Galaxy SL features TI-OMAP 1GHz processor, 4GB internal memory, 4 inch display, Android 2.2 and 5MP camera.
MRP: INR 19000
Acer Liquid Metal: This Android beauty from Acer is a good value for money and a great option for anyone looking to combine style and performance.
It  features 800MHz Qualcomm MSM7230 processor, which is also in HTC Desire Z, 5-megapixel autofocus camera with flash, 720p HD video recording,  3.6-inch display, Dolby Surround sound support, Android  2.2 and DLNA/UPnP media streaming.
MRP: INR 20,000
Samsung Galaxy Ace: Part of recent additions to Samsung’s Galaxy series, Galaxy Ace is a decent mid-range Android smartphone. It features Android 2.2 Froyo, 3.5-inch HVGA TFT display, 800MHz processor, 5-megapixel autofocus camera with LED flash, and 1350 mAh battery.
MRP: INR 15,000
Other devices in the category include HTC Wildfire, HTC Legend, Motorola Milestone, Motorola Flipout, Motorola Backflip, and Acer Liquid.
Entry-level Android smartphones in India:
Samsung Galaxy Pop: Decent performance in affordable price, comes in both GSM as well as CDMA variants. Galaxy Pop features 600 Mhz processor, Android 2.2, 3.14 inch display and 3MP camera
MRP: INR 9000
Samsung Galaxy Fit: Another budget Android smartphone from Samsung, it comes with Android 2.2, 600 MHz processor, 5MP camera and 1350 mAh battery.
MRP: 10,100
Dell XCD35: This ZTE made Android smartphone, which was launched by Dell in India has seen a huge price-drop from INR 18K to 11K today. With a great dev community, this smartphone will give you more than what you would expect.
It features 3.5 inch touchscreen, 3.2 MP camera, Android 2.1, MapmyIndia Maps pre-installed, FM Radio, HSDPA, Wifi, and Bluetooth 2.1 EDR.
MRP: INR 11,500
Huawei Ideos: Featuring a stock Android 2.2 build, this smartphone was developed with clear instructions from Google to take Android to masses. It features 2.8 inch capacitive display, 3.2 MP camera, 528 processor, and Android 2.2.
MRP: INR 8,000
LG Optimus One is another smartphone which deserves a mention here. Priced around INR 10,000, it comes with Froyo pre-installed and will get Gingerbread update soon.