Thursday, January 3, 2013

Create Signed Android Application using Eclipse

Signing Android Application

Before I tell you about creating the keystore/key in Android using Eclipse IDE, you should know that it is important to sign the Android Application as the Android system does not allow installing unsigned application on the device and also on the emulator.
Android application can be built in following two modes:
    -  debug mode: use while you are developing and testing the application
    -  release mode: use when you want to publish the application on Google Play or to provide the app to the End User.

Creating Debug Keystore/Key

It is really simple. When you run the Application from Eclipse, the debug mode is enabled by default. The ADT signs the application automatically with the debug certificate and you can run the .apk file on emulator and also on a device. The ADT integrated with Eclipse has access to Keytool utility which auto creates the debug keystore and key. By default the debug keystore/key has the following names and passwords:
    -  key.alias=“androiddebugkey”
    -  key.alias.password=“android”
Please note that you cannot release the Android Application signed in debug mode. Also, you can find the debug keystore in the .android folder (in my case C:\Users\Soofia faruq\.android\debug.keystore).

Creating Release Keystore/Key

Creating key using Eclipse IDE is really simple. Right click on your project ApiDemos à Android Tools à Export Signed Application Package as shown in picture below:
A project selection dialog appears. Here browse the project you want to export:
Next, Keystore selection dialog appears. Here you can browse the existing keystore and enter its password or in our case right now, can create a new keystore. Enter the location of the keystore and mention its name. As shown below in picture: C:\keystore\ is the location and market is the name of my keystore. Enter Password and Confirm Password for the keystore which should be strong.
Next in a new dialog as shown below you will be prompted for some more information regarding key. Enter data in all the required fields.
Specify the destination folder and name of the final build as shown below and hit Finish.
Now you have the keystore created in the defined folder and also the build. If you are building the signed application using Ant script as mentioned in the post Create Signed Build of Android Application using Ant Script then also you can use the same keystore.

Wednesday, January 2, 2013

Create Signed Build of Android Application using Ant Script

If you want to create a signed build of the Android Application using Ant Script then follow the following procedure.

As mentioned in the previous post Build Android Application Using Ant Script following files were created in the project:
    -  build.xml
    -  proguard-project.txt

Now, open the file and add the following information:
    -\\Users\\Soofia faruq\\Desktop\\Keystore\\market.keystore
    -  key.alias=marketKeystore
    -  key.alias.password=android

I am assuming that you have keystore created if not then follow my next post. Here,
    - is the path to your keystore.
    -  key.alias is the called name of your keystore.
    - and key.alias.password are optional.

If you want to keep the password secret then you don’t have to mention it here but during execution of >ant release command you will be prompted for password.

Save the and execute the >ant release command from command prompt:

You can now find the signed and aligned .apk (ApiDemos-release.apk) file in the bin folder of the project.

Tuesday, January 1, 2013

Build Android Application Using Ant Script


1.  Jdk 1.6 or later. Set JAVE_HOME to location of the Jdk.
2.  In the Android installation directory there are tools and platform-tools folder. Append the path of these folders to the PATH environment variable.
3.  Download apache-ant from I have downloaded 
4.  Extract file at any drive at root level.
5.  Add apache-ant/bin to PATH environment variable or at command prompt use the following command:  set PATH=" D:\apache-ant-1.8.4\bin";%PATH%

How to add build.xml file to existing Android project?

It is really simple and easy to add an Ant script file, build.xml, to your existing Android project. Following are the steps:
From command prompt navigate to the root directory of your project.
Enter the following command in order to add the build.xmlto the project.
    >android update project –p <path>
You can see that following files are added to your project:
    -  build.xml
    -  proguard-project.txt
Note that the above android command will only work if you have properly set the Android sdk’s tools and platform-tools folder to the PATH environment variable (as mentioned above in Pre-Requisites Step 2).

Build the Android project using Ant Script

This step is really simple, if you have properly set thevvpath of apache-ant/bin folder (as mentioned in Pre-Requisites Step 5).
Enter the following command while you are at the root directory of your Android project:
    -  ant
You will see the detail help of all the ant commands.
    >ant clean command, clean the project
    >ant release command, build the project and creates the unsigned .apk file in the /bin directory of the project.

Please follow my next post Create Signed Build of Android Application using Ant Script if you want to create a signed .apk file of your Android application.

Saturday, December 24, 2011

2nd Annual RootsTech Developers Challenge

Dear programming enthusiasts! As we all know that developers are solution providers, who with their innovative ideas and implementations provide people with astounding applications. Now, there is a big chance for the developers to demonstrate their skills in the blooming field of genealogy and family history.

The 2nd annual RootsTech Developers Challenge has been announced. All you have to do is to develop an application with the help of the provided APIs. Your application should portray the new ideas to keep track of the family history. For the details please visit RootsTech website: . Visit in order to apply for the developers challenge.

Application deadline is Jan 1, 2012 and the last date of submission of the contest entry app is Jan 15, 2012. Finalists of the competition will be announced on Jan 22, 2012. Winners will be announced live at RootsTech on Feb 2, 2012.

The reward for the best application is $5,000 cash prize. The 1st and 2nd runner-ups will also be rewarded with $3,000 and $2,000 cash prizes. So, be quick to become the part of this exciting challenge.

Wednesday, December 14, 2011

BlackBerry Bold Touch 9900 4G Review

General Introduction

BlackBerry Bold 9900 is indeed an exciting new entry with Candybar form factor and has both physical QWERTY keyboard and a glistening touchscreen. It has NFC support and is running on latest BlackBerry OS 7. It has 5 MP Camera which provides really good quality. BB Bold 9900 is almost similar to BB Bold 9930 in terms of design but it has some career dependent variations. BB Bold 9900 comes boxed up with USB cable, AC Adapter, Belt Holster and User Manual. The smartphone is available for $299.99 with 2 years contract from T-Mobile.


Display, Design & UI

BB Bold 9900 has sharp 2.8 inch capacitive touchscreen display with resolution 640x480 pixels. Display is large with TFT technology and it supports 16777261 colors. The design of the smartphone is simply superb with stainless steel metal edges. It has height 4.53 inches and width 2.6 inches. It is a thinnest BlackBerry smartphone as it has depth 0.41 inches. Its weight is 4.59 oz.


The smartphone has volume control and camera keys on the right side. On the left it has 3.5mm headphones connector and a USB port. At top it has a key for the screen lock. At the back, the smartphone has LED flash and a camera lens. Physical keyboard of the smartphone is wide and spacious with the regular Send, Menu, Back and End keys. Optical touchpad is present in the center. The keyboard typing experience is really efficient and fast.


As mentioned before BB Bold 9900 is running on latest BlackBerry OS 7 that provides Liquid Graphics technology which has really improved the response of the touchscreen and also the graphics. The navigation is smooth and quick.


The multimedia features of the BB Bold 9900 include a Music Player which supports AAC, AAC+, eAAC+, AMR, FLAC, MP3 and WMA audio formats. Video Playback supports H.263, H.264, MPEG and WMV formats. Audio and video streaming is also present. The 5MP Camera of the smartphone with the LED flash light provides excellent quality photographs. Camcorder is present and it supports 1280x720 (720p HD) resolution.

Internet browser supports HTML and HTML 5. Regular messaging services that include SMS and MMS are available with predictive text input. E-mail feature is there and also Instant Messaging. Organizer of the smartphone comprised of Alarm, Calculator, Calendar, Document viewer and To-Do List apps.

Regarding connectivity it supports Bluetooth 2.1, Wi-Fi 802.11b/g/n. USB 2.0 with micro USB connector for charging and to be used mass storage device. The smartphone supports Computer Sync, OTA Sync and NFC features. More features include Accelerometer and Compass sensors, Voice dialing and Voice recording.

Performance & Conclusion

BB Bold 9900 is running on single core, 1.2 GHz processor provides a real fast experience. Navigation is quick and smooth and applications launch in no time. The smartphone provides 768 MB RAM and 8 GB built-in storage. MicroSD and microSDHC slots are present that supports maximum 32 GB card.

Call quality of the smartphone is reasonable but the voice quality is not alright, one can experience some distortion. Data speed of the smartphone is really good with 4G speeds of the T-Mobile. The smartphone is equipped with Lithium-ion battery with 1230mAh capacity. Battery provides 6.3 hours talk time, 16 days of stand-by time, music playback of 2 days and video playback of 7.4 hours.

Overall, the BlackBerry Bold 9900 has a superb design with many improvements from latest BB OS 7. It is indeed a nice addition in the world of BB smartphones and most of the fans will definitely love to buy it. But as compared to other powerful Android smartphones, the price quoted by T Mobile is bit higher.


General Information
Gadget Type
US Service Provider
T-Mobile from Aug 03, 2011,
AT&T from Nov 06, 2011
US Service Provider Status
Network Technology
GSM 850 / 900 / 1800 / 1900 MHz,
UMTS 850 / 1900 / 2100 MHz
May 02, 2011
Market Status
Released Aug 11, 2011

4.53 x 2.6 x 0.41 inches
4.59 oz

TFT Capacitive Touchscreen, 16 M colors
2.8 inches
640 x 480 pixels
Optical trackpad, Full QWERTY keyboard

259 x 1944 pixels, 5 MP
Flash Light
Digital Zoom, Face Detection, Geo Tagging, Image Stabilizer
Video Recorder
Video Capture Resolution
1280 x 720 (720p HD)

Media Player Formats
Video Playback Formats
H.263, H.264, MPEG4, WMV

System Software & Processor
BlackBerry OS 7.0
Single core, 1.2 GHz QC 8655

768 MB
Expansion Slots
microSD, microSDHC - Up to 32 GB
Installed Memory
8 GB

3.5 mm
microUSB Version 2.0

Power & Battery
Lithium ion
1230 mAh
Stand-by Time
307 hours
Talk Time
6.30 hours

More Features
Internet Browsing
Available with HTML, HTML 5
Version 2.1, Profiles include A2DP, AVRCP, DUN, HFP, HSP, MAP, OPP, PBAP, SPP
802.11 b/g/n
SMS, MMS, Predictive Text Input, Email, Instant Messaging
Location Based Services

Running Android Sample Projects from Eclipse IDE

Hi Android Developers! This is a very short post just to let you know how you can run Android's Sample projects from Eclipse. It is very simple! If you have successfully created and run the Hello World Project as described in my previous Hello Android World post, you should now browse and check all the Samples because they are really good and helpful.

In your Eclipse IDE go to File -> Project. In the New Project – Select a wizard window, as shown below, select Android -> Android Sample Project and hit Next button.


In the next Select Build Target window, choose the SDK Android 2.1 and hit Next.


The next Select Sample window, as shown below, provides you with the list of all the sample projects with respect to the Android 2.1 SDK. Here I am going to select the sample project ContactManager. Hit Finish to continue.


In the Eclipse IDE's Package Explorer view, as shown below, you can see the sample project. Now, you can study the source files and all other folders related to project in order to learn from this sample.


Now, it is time to run the sample project, ContactManager. Right click on the project in the Package Explorer view and select Run As -> Android Application. The emulator will launch and you can see the first phone lock screen as shown below.


In the Main Menu of the Android Emulator you can see the Contact Manger application as shown below.


Run the application and you will see the following first screen with the button Add Contact.


Browse this cool app and also check other sample Android applications of the SDK. From these sample apps you will see that how powerful Android platform is and the good thing is that it is very simple and easy to learn.

Tuesday, December 13, 2011

AT&T to Help Developers Build Performance-Efficient and Energy-Efficient Apps


While developing the mobile applications, developers have to face a lot of problems. Some problems include battery drainage, application takes time to load and respond, navigation between screens is slow and many more. Mostly, when a page on your application takes time to load you just blame the cellular network for providing the slow speed connection. But this is not the case. The researchers at AT&T lab with the collaboration of students from the University of Michigan have investigated these problems and have successfully disclosed the sources of these issues. The researchers also help the developers to understand that how easily the issues can be resolved and as a result they have performance and energy efficient applications.

Here, the major thing that developers should understand is that the environment of a cellular device is different from the wired environment of a PC. The wired environment is equipped with plenty of resources and it has fast Internet connections. On the other hand, the cellular network environment has limited resources and high latencies. In the layered network architecture the developers mostly focus on the application layer and the complexities of the lower lever protocols which are hidden from them are simply ignored. Mostly, the problem lies between the complex interaction of the mobile application and device with the cellular network.

AT&T Application Resource Optimizer (ARO)

The AT&T researchers have developed and presented for the first time a profiling tool called ARO (Application Resource Optimizer) for mobile handsets. ARO tool reveals the details of the cross-layer interaction ranging from the highest application layer to the lower layers HTTP, Transport and also radio resources.

ARO system is composed of two components, a data collector that runs on a mobile handset and captures the information and an analyzer that runs on a PC in offline mode and analyzes the information fed into it. The information that is collected for analyses majorly include network packets and user input events but for more fine analysis the data regarding applications e.g. API calls and system data like CPU usage can also be used.

For demonstration of ARO, six top applications from the Android Market are used including Pandora, Fox News, BBC, Google Search, Tune-in Radio and Mobclix. The developers of these applications highly appreciated the results of ARO revealing the inefficiencies regarding resource utilization. This tool really helps developers to improve their applications and making the apps performance-efficient and energy-efficient. For the detail case studies you can study the paper, Profiling Resource Usage for Mobile Application: A Cross-layer Approach also AT&T's Coverage Article

Build Efficient Mobile Applications: The Best Practices

From the above research, the key issues that are discovered are really simple and easy to resolve. Following are some best practices shared by AT&T for the developers to follow, so that they can build efficient applications. The great thing about these practices is that they are carrier independent and developers can make efficient applications for any smartphone platform (BlackBerry, Android or iPhone etc.). You can find the detail guideline on AT&T's site as Build Efficient Apps. Following is the brief description of some of the best practices.

1. Close Connections ASAP

Close the connections as soon as they are not required anymore to prevent energy wastage. AT&T Demonstration

2. Deal with Connection Opening Problems

Sending multiple packet burst in series on opening the connection results in energy wastage of the handset and also increase the latency time. Better approach is to download all the content quickly on opening the connection in a single burst. AT&T Demonstration

3. Handle Multiple Simultaneous TCP Connections

In the wireless world the bandwidth is a limited resource. In the wired environment we can open multiple TCP connections without any bandwidth, efficiency or performance concern but in case of wireless we have to be more careful. Multiple connections for the same server can be grouped together and the results are marvelous as it reduces bandwidth, saves energy and gives better response time. AT&T Demonstration

4. Handle Duplicate Content and Caching

The applications sometimes keep downloading the data again and again even if it is not updated on the server that frequently. This quickly drains the battery. To be very truthful, one of my application working with the RSS feed is fetching the data very frequently and mostly I receive the same data because the RSS feed was not yet updated. These frequent unnecessary fetching quickly drains the battery. So, be very careful about it. AT&T Demonstration

5. Manage Peripherals

Mostly, the handsets are equipped with some hardware features like GPS, Bluetooth etc. The applications sometimes use these features and then keep them on even when the app is not using them. This also quickly drains the battery. And now I know one of my applications with the name Speedometer is unnecessarily utilizing the GPS feature and draining the battery. Make sure that your apps are not doing this. AT&T Demonstration

6. Offload to Wi-Fi

The Wi-Fi network has many benefits as compared to Mobile network. With Wi-Fi the promotion delays are very slight, it reduces data cost, provides faster connection and save the battery power. Overall it improves the user experience. So, it is absolutely great to provide your users the option within your app to switch to Wi-Fi whenever it is available. AT&T Demonstration

Above are some of the best practices. Again for complete guideline please visit Build Efficient Apps

I am very grateful to AT&T's Developer Program for sharing and providing this excellent research and guideline to help developers improve their applications.

This article is written by the permission of AT&T's Developer Program.

Wednesday, December 7, 2011

Hello World Android Application

In the previous post Android Development Environment Setup with Eclipse we have installed the Android SDK and ADT plugin for Eclipse IDE. Now, before writing the very first famous HelloWorld application, there is one more essential step that we have to perform and it is as follows.

Installing Android Platform in Eclipse

Start the Eclipse IDE and in the menu bar go to Windows -> Android SDK Manager as shown below.


By selecting the Android SDK Manager, you will see the dialog shown below. The Android SDK Manager shows the list of both Installed and Not Installed Packages. Here you can see that Android 4.0 (API 14) is already installed. I prefer to start with an older platform that is 2.1. You should be connected to the internet as the SDK Manager loads the list of Platforms and APIs from

Check the Android Platform 2.1(API 7) and also check the Extras (if not installed) which include some more packages that you might need in the future. Hit Install [Count] packages button at the right bottom of the window to continue with the installation process.


The next dialog/window again asks about the packages to be installed and also shows the package description and license agreement. Check the Accept All for the licenses and hit Install.

The installation process will take time. So, be very patient! As the installation completes you can see the installed packages as shown in the window below.


Now we are ready to write the Hello World Android application.

Creating Android Project

In Eclipse IDE go to File -> New -> Project. In the New Project window as shown below select the Android Project and hit Next button.


The following New Android Project window will be shown. Here enter the name of the project as AndroidApp1 and hit Next.


In the next window Select Build Target as shown below, check the Android 2.1 as the target and hit Next button.


The following Application Info window will appear. Here enter the name of the package as com.androidapp.helloworld.

Create Activity checkbox is checked by default with the name AndroidAppActivity. Minimum SDK should be 7 (Android 2.1). Activity is an Android Application Component that represents a screen with a particular task. Now hit Finish button.


The project is created successfully.

Exploring Android Project

You can see in the following Package Explorer window, all folders and files that are created.


The above Package Explorer window of the project AndroidApp1 shows the src, gen, assets and res folders. Let us explore these folders.

- src/ Contains all the source code.
o    src/com.androidapp.helloworld/
Starting point of the application.  Following source code is written in this file.
package com.androidapp.helloworld;

import android.os.Bundle;

public class AndroidApp1Activity extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
This activity launches the application and this property of it is specified in the AndroidManifest.xml file mentioned below.
·         - gen/ Contains an auto generated resource management file
·         - assets/ Contains un-compiled resource files of the project.
·         - res/ Contains and manages all resources(graphics, images, animations, strings ) of the application.
o   res/drawable Contains the graphic resources (application icon) according to different screen sizes etc like here there are three different drawable folders created drawable-hdpi, drawable-ldpi and drawable-mdpi according to screen densities.
o   res/layout/main.xml The layout folder contains the layout information of the screens. Here main.xml contains the layout detail of the only screen that is drawn in this application. Following is the content of the main.xml file.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    android:orientation="vertical" >
        android:text="@string/hello" />
If you want the layout to be different when the orientation changes then you can easily specify it in this folder.
o   res/values/strings.xml This file contains all the string resources. Following is the content of this file.
<?xml version="1.0" encoding="utf-8"?>
    <string name="hello">Hello World, AndroidApp1Activity!</string>
    <string name="app_name">AndroidApp1</string>
·- AndroidManifest.xml This file contains all the configuration detail of the application. Open this file to view it. You can see that it is organized in five different tabs that are Manifest, Application, Permissions, Instrumentation and AndroidManifest.xml.

The first tab shows the Manifest General Attributes that are Package Name, Version Code, Version Name etc.


Following is the second tab, Application. As the name suggests this tab is all about Application Attributes and other major information detai of the application. As you can see Label and Icon attributes are defined. Activities within the application are also defined here. Moreover, application services and functionalities can be defined under this tab.


The following is the third Permissions tab. Under this tab you can add all the permissions that are required by the application for performing a specific task. For example, if the application is required to use the camera of the phone then it should add the permission android.permision.CAMERA.


Fourth Instrumentation tab is shown below. This tab is used to add the instrumentation classes required during the unit testing of the application.

Fifth tab is of AndroidManifest.xml as shown below. This file contains all the manifest configuration settings in the simple XML format.


Now if you want to make your application debuggable, then you have to configure your application using the Android Manifest. Under the Android Manifest Application tab set the Debuggable attribute to true. You can see the android:debuggable="true" added in the AndroidManifest.xml file as the attribute of the application.


Running/Debugging Android Application

For running/debugging the android application you have to first create the Android Virtual Device (AVD). In Eclipse IDE go to Window -> AVD Manager. Android Virtual Device Window will open.

In the AVD Manager window click New button. The following Create new AVD window will popup. Enter the name of the device as the_avd or any other name you like and select the Android2.1 – API Level 7 Platform as the target. Do the settings as shown in the window below and hit Create AVD button at the bottom.


In the AVD Manager Window as shown below you can see the Android Virtual Device with the name the_avd for Android 2.1 platform is created. Now close this window.


Second step is the run/debug configurations step.  Right click on the project in Package Explorer window and select Debug As -> Debug Configurations… Youwill see the following Debug Configurations window. Here select the Android Application from the left vertical menu to create the New_Configuration. Under the Android tab at right Browse the application AndroidApp1.


Now we are ready to run the application in the emulator. Hit the Debug button shown in the configurations window above. As the debug configurations are done you can now debug the application by right clicking on the project in the Package Explorer and go to Debug As -> Android Application or you can simply press the small bug button of the eclipse present in the main toolbar.

The first launch of the application may take time, so you have to wait a little bit. First you will see the following Android splash screen.


The next screen is the following phone lock screen.


And then after sometime as soon as the debugger is attached and the application launches, you will see following screen with the string output Hello World, AndroidApp1Activity!


Hit the back button to close the application. Open the Main Menu of the emulator and you can see the following screen with your application AndroidApp1 icon. You can always use this icon to launch the application.


Now without closing the emulator open the strings.xml file in the eclipse and update the output string to Hello Android World, AndroidApp1Activity! As shown below.

<string name="hello">Hello Android World, AndroidApp1Activity!</string>

Save the file and hit Debug. Note that the emulator is still running. You will see the updated output as shown below as soon as the application re-launches itself. Here the point is that for the updates you are not required to close the emulator. Just debug/run the application again and you will see the application changes reflected in the running emulator. Following is the new output.


I hope this tutorial will help you in creating and understanding your very first Android application. Feel free to question about it in the comment section below.

Twitter Delicious Facebook Digg Stumbleupon Favorites More