Wednesday, August 31, 2011


Unit Tests Android :


Test parts of the application in isolation with little connection to the underlying system. 
In such cases we have to select a base class that is high enough in the hierarchy to remove some of the dependencies but not high enough for us to be responsible for some of the basic infrastructure.


The candidate base class in this case is possibly AndroidTestCase. 
For example: Android CTS test suite (http://source.android.com/compatibility/cts-intro.html)


Its a group (batch) of unit tests for H/W devices on which Android OS planned to be shipped. 
It shows the basic compatibility of H/W to run Android OS. 


Next step is to run Android CTS unit test, will shared in next session how to run CTS on emulator or Android device. 

Monday, July 11, 2011

Android Sandbox: 
sandbox is a testing environment that isolates untested code changes and outright experimentation from the production environment or repository, in the context of software development including Web development and revision control. Sandboxing protects "live" servers and their data, vetted source code distributions, and other collections of code, data and/or content, proprietary or public, from changes that could be damaging (regardless of the intent of the author of those changes) to a mission-critical system or which could simply be difficult to revert

Sandboxes replicate at least the minimal functionality needed to accurately test the programs or other code under development (e.g. usage of the same environment variables as, or access to an identical database to that used by, the stable prior implementation intended to be modified; there are many other possibilities, as the specific functionality needs vary widely with the nature of the code and the application[s] for which it is intended.)

Tuesday, April 26, 2011

Are the processors 64-bit on Ubuntu?

A 64-bit processor will have lm ("long mode") in the flags section of cpuinfo. A 32-bit processor will not.

e.g.,

flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy ts fid vid ttp tm stc

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

Are the processors dual-core (or multi-core)?

$ grep 'cpu cores' /proc/cpuinfo
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2
cpu cores       : 2

"2" indicates the two physical processors are dual-core, resulting in 4 virtual processors.

If "1" was returned, the two physical processors are single-core. If the processors are single-core, and the number of virtual processors is greater than the number of physical processors, the CPUs are using hyper-threading. Hyper-threading is supported if ht is present in the CPU flags and you are using an SMP kernel.

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

CPU Information: 

cat /proc/cpuinfo

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

Installing Eclipse and the Android SDK (Ubuntu 8.04/8.10):

http://androidforums.com/developer-101/2321-installing-eclipse-android-sdk-ubuntu-8-04-8-10-a.html

Tuesday, December 07, 2010

MonkeyRunner Testing on Android - Kapil Sharma


The android monkeyrunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code. 

With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation. 

The monkeyrunner tool is primarily designed to test applications and devices at the functional/framework level and for running unit test suites, but you are free to use it for other purposes.

The monkeyrunner tool is not related to the UI/Application Exerciser Monkey, also known as the monkey tool. The monkey tool runs in an adb shell directly on the device or emulator and generates pseudo-random streams of user and system events. 

In comparison, the monkeyrunner tool controls devices and emulators from a workstation by sending specific commands and events from an API.
The monkeyrunner tool provides these unique features for Android testing:
  • Multiple device control: The monkeyrunner API can apply one or more test suites across multiple devices or emulators. You can physically attach all the devices or start up all the emulators (or both) at once, connect to each one in turn programmatically, and then run one or more tests. You can also start up an emulator configuration programmatically, run one or more tests, and then shut down the emulator.
  • Functional testing: monkeyrunner can run an automated start-to-finish test of an Android application. You provide input values with keystrokes or touch events, and view the results as screenshots.
  • Regression testing - monkeyrunner can test application stability by running an application and comparing its output screenshots to a set of screenshots that are known to be correct.
  • Extensible automation - Since monkeyrunner is an API toolkit, you can develop an entire system of Python-based modules and programs for controlling Android devices. Besides using the monkeyrunner API itself, you can use the standard Python os and subprocess modules to call Android tools such as Android Debug Bridge.
    You can also add your own classes to the monkeyrunner API. This is described in more detail in the section Extending monkeyrunner with plugins.

    The monkeyrunner tool uses Jython, a implementation of Python that uses the Java programming language. Jython allows the monkeyrunner API to interact easily with the Android framework. With Jython you can use Python syntax to access the constants, classes, and methods of the API.

Android 2.3 Official Video

Android 2.3 SDK :

http://developer.android.com/sdk/android-2.3.html

New User Features:
1.) UI refinements for simplicity and speed
2.) Faster, more intuitive text input
3.) One-touch word selection and copy/paste
4.) Improved power management
5.) Control over applications
6.) New ways of communicating, organizing

New Developer Features
1.) Enhancements for gaming
2.) New forms of communication
3.) Rich multimedia

New Platform Technologies
1.) Media Framework
2.) New Linux Kernel
3.) New Dalvik runtime

Tuesday, June 08, 2010


Apps on sdcard -- can't install apps anymore: Tips for installation.

Try this trick:

kash@ubuntu:- /xyz$ adb shell

# cd system/app

# chmod 771 app

# exit

kash@ubuntu:- /xyz$ adb install kash.apk

And the the .apk installed on Android device.


Monday, May 24, 2010

Android Froyo 2.2 SDK release.


Froyo >> 2.2 New SDK

1.) Dalvik JIT, improve CPU performance 2-5 times
2.) V8 JavaScript engine, improve browser JavaScript performance by 2-3 times
3.) 3G tethering via USB and Wifi
4.) New camera UI for controlling zoom, flash, white balance, geo-tagging, focus and exposure.
5.) Microsoft exchange support, incl remote wipe
6.) Bluetooth: share contacts, voice dialing
7.) Android market: app crash/freeze report, auto app update
8.) App2SD
9.) Option for automatic app data backup
10.) Android Cloud to Device Messaging
11.) Supports Macromedia Flash 10.1
12.) Enable/disable data access over Mobile network
13.) Multiple keyboard languages
14.) Voice recognition for 7 dialects of English, Mandarin Chinese, and Japanese
15.) PIN screen lock

Saturday, January 30, 2010


Reading Data from the Database:

There are many ways to read data from an SQL database, but they all come down to a basic sequence of operations:

  1. Create an SQL statement that describes the data that you need to retrieve.

  2. Execute that statement against the database.

  3. Map the resulting SQL data into data structures that the language you're working in can understand.

Saturday, December 19, 2009


On exploring databases on the emulator and available devices:

Many content providers in Android use SQLite databases (http://www.sqlite.org/),
user can use tools provided both by Android and by SQLite to examine the databases.
Many of these tools reside in the \android-sdk-install-directory\tools subdirectory.

One of the tools is a remote shell on the device that allows user to execute a command-line
SQLite tool against a specified database.

Android uses another command-line tool called Android Debug Bridge (adb), which is
available as " tools\adb.exe "

Thursday, November 26, 2009


Android Database:

Android's Java interface to its relational database, SQLite.
It supports an SQL implementation rich enough for anything you're likely to need in a mobile application, including a cursor facility.

ContentProvider:

An interface used between applications.

The server application that hosts the data manages it through basic create, read, update, and delete (CRUD) operations.

The client application uses a similar API, but the Android framework transmits the client's requests to the server.

Wednesday, July 01, 2009


Android Database Design Considerations :

There are main two considerations specific to Android that consider when designing database:

A.)  Files (such as bitmaps or audio fi les) are not usually stored within database tables.
Instead, use a string to store a path to the fi le, preferably a fully qualifi ed Content Provider URI.

B.)  While not strictly a requirement, it’s strongly recommended that all tables include an 
auto-increment key fi eld, to function as a unique index value for each row. 
It’s worth noting that if you plan to share your table using a Content Provider, 
this unique ID fi eld is mandatory.

Opening and Creating Databases without the SQLiteHelper:

You can create and open databases without using the SQLiteHelper class with the 
openOrCreateDatabase method on the application Context.

Setting up a database is a two-step process. 

First, call openOrCreateDatabase to create the new data-base. 
Then, call execSQL on the resulting database instance to run the SQL commands that will create 
your tables and their relationships. 

Using the SQLiteOpenHelper:

SQLiteOpenHelper is an abstract class that wraps up the best practice pattern for creating, opening, and upgrading databases. 

By implementing and using an SQLiteOpenHelper, you hide the logic used to decide if a database needs to be created or upgraded before it’s opened.

The code snippet shows how to extend the SQLiteOpenHelper class by overriding the construc-tor, onCreate, and onUpgrade methods to handle the creation of a new database and upgrading to a new version, respectively. 

Example of use of databse in Android Apps. code:

  public MyObject getEntry(long _rowIndex) {
    MyObject objectInstance = new MyObject();
    // TODO Return a cursor to a row from the database and
    // use the values to populate an instance of MyObject
    return objectInstance;
  }
  public int updateEntry(long _rowIndex, MyObject _myObject) {
    String where = KEY_ID + “=” + _rowIndex;
    ContentValues contentValues = new ContentValues();
    // TODO fill in the ContentValue based on the new object
    return db.update(DATABASE_TABLE, contentValues, where, null);
  }

Android and use of Databases:

Plan to create a database adapter, which adds an abstraction layer that encapsulates database inter - actions. It should provide intuitive, strongly typed methods for adding, removing, and updating items. 

A database adapter should also handle queries and wrap creating, opening, and closing the database.

It’s often also used as a convenient location from which to publish static database constants, including table names, column names, and column indexes.