Wednesday, July 25, 2012

Android - Shell & Deployment

,

 Android Debugging Bridge - Shell

You can access your Android emulator also via the console. Open a shell, switch to your "android-sdk" installation directory into the folder "tools". Start the shell via the following command "adb shell".

adb shell 
You can also copy a file from and to your device via the following commands.

// Assume the gesture file exists on your Android device
adb pull /sdcard/gestures ~/test
// Now copy it back
adb push ~/test/gesture /sdcard/gestures2 

This will connect you to your device and give you Linux command line access to the underlying file system, e.g. ls, rm, mkdir, etc. The application data is stored in the directory "/data/data/package_of_your_app".
If you have several devices running you can issue commands to one individual device.

# Lists all devices
adb devices
#Result
List of devices attached
emulator-5554 attached
emulator-5555 attached
# Issue a command to a specific device
adb -s emulator-5554 shell 

Uninstall an application via adb

You can uninstall an android application via the shell. Switch the data/app directory (cd /data/app) and simply delete your android application.
You can also uninstall an app via adb with the package name.

adb uninstall <packagename> 

Emulator Console via telnet

Alternatively to adb you can also use telnet to connect to the device. This allows you to simulate certain things, e.g. incoming call, change the network "stability", set your current geocodes, etc. Use "telnet localhost 5554" to connect to your simulated device. To exit the console session, use the command "quit" or "exit".
For example to change the power settings of your phone, to receive an sms and to get an incoming call make the following.

 
# connects to device
telnet localhost 5554
# set the power level
power status full
power status charging
# make a call to the device
gsm call 012041293123
# send a sms to the device
sms send 12345 Will be home soon
# set the geo location
geo fix 48 51 
 

For more information on the emulator console please see Emulator Console manual

* Deployment

Overview

In general there are you restrictions how to deploy an Android application to your device. You can use USB, email yourself the application or use one of the many Android markets to install the application. The following describes the most common ones.

Deployment via Eclipse

Turn on "USB Debugging" on your device in the settings. Select in the settings of your device ApplicationsDevelopment, then enable USB debugging.
You may also need to install the a driver for your mobile phone. Linux and Mac OS usually work out of the box while an Windows OS typically requires
For details please see Developing on a Device . Please note that the Android version you are developing for must be the installed version on your phone.
To select your phone, select the "Run Configurations", select "Manual" selection and select your device.


The Android Run Configuration on the Target Tab, selecting the "Manual" flag.


Show the selection of the real device to deploy on it.


Android application must be signed before they can get installed on an Android device. During development Eclipse signs your application automatically with a debug key.
If you want to install your application without the Eclipse IDE you can right click on it and select Android ToolsExport Signed Application Package.
This wizard allows to use an existing key or to create a new one.
Please note that you need to use the same signature key in Google Play (Google Market) to update your application. If you loose the key you will NOT be able to update your application ever again.
Make sure to backup your key.

Via external sources

Android allow to install applications also directly. Just click on a link which points to an .apk file, e.g. in an email attachment or on a webpage. Android will prompt you if you want to install this application.
This requires a setting on the Android device which allows the installation of non-market application. Typically this setting can be found under the "Security" settings.

Google Play (Market)

Google Play requires a one time fee, currently 25 Dollar. After that the developer can directly upload his application and the required icons, under Google Play Publishing .
Google performs some automatic scanning of applications, but no approval process is in place. All application, which do not contain malware, will be published. Usually a few minutes after upload, the application is available.

(vogella.com)

0 comments to “Android - Shell & Deployment”

Post a Comment

 

Android Development Tutorials Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger Templates