Wednesday, July 27, 2011

Get the list of activities/applications installed on Android

Following is the code to get the list of activities/applications installed on Android :
 final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
 final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

 You will get all the necessary data in the ResolveInfo to start a application. You can check ResolveInfo javadoc here.

 Here's a cleaner way using the packageManager
 final PackageManager pm = getPackageManager();
 //get a list of installed apps.
 List<ApplicationInfo> packages = pm

 for (ApplicationInfo packageInfo : packages) {

 Log.d(TAG, "Installed package :" + packageInfo.packageName);
 "Launch Activity :"
 + pm.getLaunchIntentForPackage(packageInfo.packageName));

 }// the getLaunchIntentForPackage returns an intent that you can use with startActivity()

 More info here

 To filter on sytem based apps :
 private boolean isSystemPackage(ResolveInfo ri){
 return ((ri.activityInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM)!=0)?true:false;


Monday, July 25, 2011

How to Build Funambol

Your trail:



Don't use it

Please refer to


Funambol is migrating all its components (at least when possible) to the Maven building system. You need to be familiar with Maven and its basic concepts in order to fully understand the below steps. You can find more information about Maven in the resource section.Thanks to maven, you do not usually have to worry about CVS and CVS tags (or SVN) in order to work with Funambol. You just need to know which components you need and which version. You do not even have to know how to download the components you need, once you have configured Maven, it will do all the magic for you. All components binaries are published on a public maven repository at, which is where maven will download everything it requires.
As a result of this new build structure, you will be able to package a Funambol distribution without the need of a single line of code. This allows us to decouple the development-compile-test process from the building of a distributable package. It is much easier, for example, set up a continuous integration server that builds nightly all components and make them available on a repository. Then you can easily have a separate packaging process that builds a distributable package containing a subset of the released components.
One of the biggest advantages of this approach is that if you are a developer of a specific component, for example the foundation module, you do not need to know how to build the entire CVS tree to work. You just checkout the component work on it, publish your artifact and you are done.
This document describe how to package a Funambol distribution first, and then how to build the source code.
Note that at the time of writing Ant is still required for some components or as a glue multi-platform scripting language.


Before moving on, make sure the following pre-requirements are installed in your environment.
  • J2SE 1.5. See its documentation for details about installation.
  • Ant 1.6.5
  • Maven 2.0.9
  • Netbeans 5.5 platform: download the zip file and unpackage it where you want (we will refer to this directory with<NETBEAN_PLATFORM>)
  • Apache Tomcat 6.0.16: download and save it in <TOOLS>
  • Hypersonic DB 1.8.0: download (or newer) and save it in <TOOLS>
  • NSIS 2.2x: download the exe file and install it where you want (we will refer to this directory with <NSIS>). You should also install theInetc plug-in copying inetc.dll in <NSIS>\plugin.

Setting up the environment

Your building environment needs some customization.

Setting up Ant

Copy the following jars $ANT_HOME/lib (those files enable ant for scripting and for maven tasks):

Configuring maven

Maven must be configured with the Funambol maven repository. Add the following section to the active maven profile (in $HOME/.m2/settings.xmlor C:\Documents and Settings\<username>\.m2):
See settings.xml for an example.

Preparing JRE zip file for Windows system

Note that this JRE will be included in the bundle and in the Administration Tool for Windows system so if you are not interested on those you can skip this step.
  • Download JRE 1.5.0_xx from SUN website and install it in <JRE>.
  • Zip <JRE> in a file with name

This zip file should contain:
Copy the file in <TOOLS>.

Getting JRE for Linux system

Note that this JRE will be included in the bundle for Linux system so if you are not interested on that you can skip this step.Download jre-1_5_0_xx-linux-i586.bin from SUN website and save it in <TOOLS>.

Getting Funambol sources

In order to get the sources, execute the following commands:cvs login
cvs -z3 co capri

when a password is asked during login command, press Enter. This will checkout the source code in <capri> directory.
In order to checkout a specific release, you should checkout the code using the wanted tag:
cvs login
cvs -z3 co -r tag capri

Configuring the environment

Edit <capri>/forge/ changing the following properties:
  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
  • tomcat.pkg=<TOOLS>/
  • hsqldb.pkg=<TOOLS>/
On Windows system:

  • jre.pkg=<TOOLS>/
  • nsis.home=<NSIS>
On Linux system:

  • jre.pkg=<TOOLS>/jre-1_5_0_xx-linux-i586.bin
Edit <capri>/admin-suite/ changing the following property:

  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
On Windows system:
  • nsis.home=<NSIS>

Build the bundle

Move under <capri>/forge and run one between the following commands depending on what you want to forge/build:
  • ant forge-bundle-win: forge the bundle for Windows system
  • ant forge-bundle-unix: forge the bundle for Unix/Linux system

Build the Administration tool

If you want to build only the Administration tool, you should download just its code executing the following commands:cvs login
cvs -z3 co 3x/admin-suite

(remember to specify a tag if you want to build a specific version).
Edit admin-suite/ changing the following property:

  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
On Windows system:
  • nsis.home=<NSIS>
  • jre.pkg=<TOOLS>/ (this property is missing in the file and must be added)
Then simply move in 3x/admin-suite and run:
  • ant forge-admin-unix: forge the tgz version
  • ant forge-admin-win: forge the exe version for windows
In the target directory you should find the packages.

Build the iPod plugin

If you want to build only the iPod plugin, you should download just its code executing the following commands:cvs login
cvs -z3 co funambol/clients/ipod

(remember to specify a tag if you want to build a specific version).
then simply move in funambol/clients/ipod directory and run:
  • mvn package: forge the tgz version
  • mvn package exec:exec: forge the exe version for windows
In the target directory you should find the packages.

Build the SDK

If you want to build only the SDK, you should download just its code executing the following commands:cvs login
cvs -z3 co funambol/sdk

(remember to specify a tag if you want to build a specific version).
then simply move in funambol/sdk directory and run:
  • mvn package
In the target directory you should find the packages.

Build ALL

For convenience, a script to build all components respecting the dependencies order is available. Check out all the required source code executing the following commands:cvs login
cvs -z3 co capri-server

(remember to specify a tag if you want to build a specific version).
Configure capri-server/forge/ and capri-server/admin-suite/ as previously specified
Move in capri-server/forge and run:
  • ant forge-all


Maven resources

Funambol m2 Repo

Sunday, July 24, 2011

Analysis and Comparison with Android and iPhone Operating System

Lu Cheng
1 System Development History
1.1 History of Android
Android is not only a mobile operating system that uses a modified version of the Linux kernel [1][2][3],
but also a software stack for mobile devices that includes an operating system, middleware and key
In July 2005, Google bought Android, Inc., a tiny startup company based in Palo Alto, California, USA. At
Google, the team led by Rubin developed a mobile device platform powered by the Linux kernel and their
main marketing targets were hardware component and software partners with an easy and flexible
operating system. On the November 5th in 2007, several companies including Google, HTC, Motorola,
Intel and so on came together to form the Open Handset Alliance and stated the goal for developing open
standards for mobile devices, meanwhile unveiled the new product: Android, a mobile device platform
built on the Linux kernel version 2.6[4]. Android has been available as open-source software since October
2008. Under the Apache License, private companies could add on their own applications and extensions
and sell them, without having to submit them to the open-source community [5]. Since its original release,
Android has seen a number of updates with fixed bugs and new features. Cupcake (the official 1.5 update),
which based on Linux kernel 2.6.27 was released on 30 April 2009. Cupcake improves the ability to record
and watch videos with the camcorder mode and enable uploading videos to YouTube and pictures to
Picasa directly from the phone. The Cupcake also supports Bluetooth A2DP and can connect to a
Bluetooth headset within a certain distance. On 15 September 2009, Donut (the 1.6 SDK) was released.
Donut improved Android Market experience and provides an integrated camera, camcorder and gallery
interface. It also updated Voice Search to have a faster response time deeper integration with native
applications. Search experience and technology support are also updated. The updated version 2.0, Eclair
was released on 26 October 2009. It optimized the hardware speed and support for more screen sizes and
resolutions. Eclair introduced new browser UI and new contact lists, and provides better white/black ratio
for backgrounds. Besides, it built in flash support for Camera and enables the digital zoom. The
subsequent version 2.1 is named FroYo and the next update after FroYo will be called Ginerbread.

1.2 History of iPhone
iPhone operating system is a mobile operating system developed and marketed by Apple Inc. It is the
default operating system for the iPhone, the iTouch and the iPad. The iPhone OS was derived from Mac
OX X and the version history of iPhone OS began at June 29, 2007 with the release of the iPhone [6].
iPhone OS had no official name until the first beta version of the iPhone SDK released in March 6, 2008.
Before then, Apple marketing literature simply stated the iPhone uses OS X. The initial version of iPhone
was released on June 29, 2007. The version 1.0.2 was initially released on iPod Touch on September 14,
2007. Version 1.1.1 updated the interface for the calculator application, supported the TV out and
provided adjustable volume and louder speakerphone. Later the version 1.1.2 was released on November
12, 2007. It provides the battery charge level indicator and international language & keyboard
support. Version 1.1.3 provides more feature then previous versions. It added the mail, maps, stocks,
weather and notes applications for iPod touch, enable lyrics support for music and chapter support for
movies. Besides, it increased the SMS storage capacity from 1,000 to 75,000 and gains the new feature on
Google Maps, the 'Locate Me' can determine the phone's approximate location. Version 1.1.4 and 1.1.5
was released on February 26, 2008 and July 15, 2008 respectively. They fixed bugs and improve the speed
of interface. The version 2.0 was available with the release of the iPhone 3G on July 11, 2008. It enhanced
the operating system, making it able to turn Wi-Fi back on in Airplane mode and support SVG and Cisco
IPsec VPN. 2.0 also enhance the language by providing extra keyboard languages and support the
traditional and simplified Chinese handwriting recognition. On September 9, 2008, Apple Inc. released the
version 2.1. It fixes the bugs and enhances the system performance. It provides new OS features like
changed 3G, EDGE and GPRS indicators, turn off the camera within the restrictions page. Besides, version
2.1 provides the new application features like more information within iPod music lists and audiobooks.
The version 2.2 which released on November 21, 2008 enhances the performance on maps and mail,
improved the stability and performance of Safari. It also improved the performance on many aspects like
the sound quality of visual voicemail message and so on. On June 17, 2009, Apple Inc. released the version
3.0 with the iPhone 3GS. Current version is 3.2 which published on January 27, 2010. It supports the newly
announced iPad and the landscape springboards, added terrain view in maps application.
2 System Architecture
2.1 Android Architecture
The Android architecture has several layers as showed in Figure 1.
Kernel: Linux is support for core system services such as security, memory management, process
management, network stack, and driver model [7]. The kernel also acts as an abstraction layer between
the hardware and the rest of the software stack.
Figure 1. Android Architecture
Runtime: Runtime includes core libraries and Dalvik virtual machine. Core libraries have a set of core
libraries that provides most of the functionality available in the core libraries of the Java programming
language. Every Android application runs in its own process, with its own instance of the Dalvik virtual
machine. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for
minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language
compiler that have been transformed into the .dex format by the included "dx" tool. The Dalvik VM relies
on the Linux kernel for underlying functionality such as threading and low-level memory management.
Libraries: Android has a set of C/C++ libraries used by various components of the Android system. These
libraries are exposed to developers. The system C library is a BSD-derived implementation of the standard
C system library. The media libraries are based on PacketVideo’s openCORE which support playback and
recording of many popular audio formats. The surface manager manages access to the display subsystem
and seamlessly composites 2D and 3D graphic layers from multiple applications.
Application Framework: All Android applications are written with Java programming language, it ships
with a set of core applications including email client, SMS program, calendar, maps, browser, contacts and
others. Android offers developers the ability to build various applications with an open development.
Developers have full access to the same framework APIs used by the core applications. The application
architecture is designed to simplify the reuse of components; any application can publish its capabilities
and any other application may then make use of those capabilities. This same mechanism allows
components to be replaced by the user. The applications including views that can be used to build an
applications, including lists, grids, text boxes, buttons, and even an embeddable web browser. Content
providers enable applications to access data from other applications or to share data with others. The
resource manager providing access to non-code resources such as localized strings, graphics and layout
files. The notification manager enable all applications to display custom alter in the status bar. The activity
manager manages the lifecycle of applications and provides a common navigation backstack.
2.2 iPhone Architecture
Figure 2. iPhone Architecture
Hardware: In iPhone, Hardware refers to the physical chips soldered to the iPhone’s circuitry. The actual
processor falls under this layer, but the instruction set and in-memory descriptor tables are contained
within the “processor” layer.
Firmware: Firmware refers the chip-specific code that is either contained with memory in/around the
peripheral itself, or within the drive for said peripheral.
Processor: Processor is refers to the ARM instruction set and the interrupt descriptor table as set up by
the iPhone OS during boot and driver initialization.
iPhone OS: iPhone OS is the kernel, drivers, and services that comprise of the iPhone Operating System. It
sits between the user space and hardware.
Objective-C Runtimes: Objective-C runtime is comprised of both the Objective-C dynamically-linked
runtime libraries, as well as the underlying C libraries.
Frameworks/API: Frameworks/API layer has API calls which are Apple-distributed headers with the iPhone
SDK, with some dynamic linking occurring at runtime. These reside on top of the Objective-C runtime, as
many of these are written in Objective-C.
Application: The application stored in iPhone has to be purchased through the application store. This
application was compiled to native code by the Apple-distributed iPhone compiler, and linked with the
Objective-C runtime and C library by the linker. The application also runs entirely within the user space
environment set up by the iPhone OS.
3 Hardware
3.1 Android
Android is used as mobile operating system for many mobile phones, like Motorola CLIQ, Samsung Behold
and so on. DROID by Motorola adopt Android 2.0 as the operating system.
Processor: process in DROID is Arm® CortexTM A8 which based on the ARMv7 architecture with the speed
of 550 mHz. The high-performance of Arm® CortexTM A8 processor is proven in end devices today as it can
meet the requirements for power-optimized mobile devices needing operation in less than 300mW.
Memory and secondary storage: The Motorola Droid has only 256MB of memory on which it can store
applications and it cannot run applications off the SD Card. The secondary memory for music, image and
general storage installed in DROID is 16 GB microSD, a removable flash memory cards. It also can support
up to 32 GB microSD.
Camera: The camera with automatic focus and dual led has 5 MP megapixels and 4x digital zoom, it has
the features like image stabilization, real-time color effects, scene modes and location tagging.
Sensor: The sensor in DROID has proximity, ambient light and eCompass.
Screen: The screen is 3.7 inch with 16:9 widescreen with TFT display type.
Battery: The DROID uses 1400 Ah Li Ion battery with up to 270 hours standby time, the continuous usage
time is up to 358 minutes.
Media and Network: The DROID has the audio and video streaming media and supports multiple video
formats like AAC, MP3, WAV, MIDI and so on. It supports Wi-Fi and Bluetooth, the GPS provides the
service like aGPS, sGPS, Google maps, eCompass.
3.2 iPhone
The iPhone operating system is used on iPhon3, iTouch and iPad.
Processor: Samsung S5PC100 (ARM Cortex A8 @ 600 MHz. The processor in the 3GS at 600 MHz is 1.5x
faster in terms of raw MHz, but it’s based on the Cortex A8 which uses the more advanced ARM v7
architecture versus the 3G model at ARM v6[10].
Memory and secondary storage: The memory in iPhone is only 128MB, but it supports 8GB second
storage for general storage.
Screen: The screen in iPhone is a 9 cm liquid crystal display with scratch-resistant glass and 18-bit color.
The touch screen has multi-touch sensing and its touch and gesture features are based on technology
developed by FingerWorks [9].
Sensor: The iPhone has three sensors, proximity sensor deactivates the display and touch screen, it save
the battery power and prevent inadvertent inputs. The ambient light sensor adjusts the display
brightness and hence also saves the battery power. The 3-axis accelerometer sensor senses the
orientation of the phone and changes the screen accordingly. Plus, moisture sensor installed in iPhone is
capable to detect whether the device has been affected or damaged by water.
Media and network: The audio processing plug-ins, known as audio units, can be dynamically accessed
from the user’s iPhone OS application. It allows user to add a variety of useful, prepackaged audio
features and take advantage of the low latency that audio units offer. iPhone OS ships with audio units
that support mixing, equalization, format conversion, and I/O for recording, playback, or live chat. The
built-in Bluetooth 2.x + EDR support the wireless earpieces and headphones. Stereo audio was added in
the 3.0 update for hardware that supports A2DP. With these profiles, iPhone can exchange multimedia
files like pictures, music and video, with other Bluetooth enabled cell phones
Battery: iPhone has an internal rechargeable battery which is not user-replaceable. The battery can be
charged when connect the iPhone to a computer via USB to dock connector cable. The official report from
Apple's website says that the battery life is designed to retain up to 80% of its original capacity after 400
full charge and discharge cycles. The iPhone's battery is capable of providing up to 250 hours standby, 24
hours of music, seven hours of video, six hours of web browsing and eight hours of talk time.
Camera: iPhone has a built-in fixed focus 2.0 megapixel camera located on the back for digital photos. The
camera has no optical zoom, flash or auto-focus, and does not supporting video recording neither. iPhone
3GS has a 3.2 megapixel camera which supports auto focus, auto white balance and video recording. The
video can be uploaded to YouTube or other services directly.
4 System management
4.1 Thread management
When the first of an application's components needs to be run, Android starts UI thread, a Linux process
for it with a single thread of execution. The UI thread, which also know as main thread is automatically
created when an Android application is started. UI thread is very important because it takes in charge of
dispatching the event to the appropriate widgets. UI thread also the thread people interact with the
Android widgets. When people touches a button, the UI thread will dispatches the touch event to the
widget which in turn sets its pressed state and posts an invalidate request to the event queue. It
dequeues the request and notifies the widget to redraw itself. By default, all components of the
application run in that process and thread. Each component is run by a process, and the component
elements have a process attribute which specify the process where the component should run. By setting
bthe attributes in different way, it is easy to know whether the component run in its own process or share
a process with other components. No component should perform long operation when called by the
system in order not to block other components which also in the process. Besides, when the memory is
low and other processes have more immediately requirement, the Android will decide to shut down a
process. The application components running in that process will be destroyed consequently. Therefore,
android weights the importance of each thread to the user to decide the victim.
Android provides Handler and Looper to manage threads and let them communicate with each other.
Looper is used for running a message loop within a thread, headler is processing the messages and
HandlerThread is setting up a thread with a message loop. After a child thread create an image from the
web, it notifies the UI thread by sending a message using the handler that's bound to UI thread's message
queue. The data produced by the child process can also send via the message. Therefore, the UI thread
can update with the data produced by the child thread. When a Handler is created, it is bound to the
message queue of the thread that created it.
In iPhone OS, each application is made up of one or more threads, which represents a single path of
execution. Every applications starts with a single thread, which runs the application's main function. The
applications can have additional threads with executes a specific function. When application generates a
new thread, it becomes an independent entity inside the process space. Each thread has its own
execution stack and the kernel schedules its run time separately. As threads are in the same process space,
they can communicate with other threads and processes. All threads in a single application share the
same virtual memory space and have the same access rights as the process itself. Each thread requires
the memory allocation in both the kernel memory space and the program memory space. The core
structures needed to manage the thread and coordinate its scheduling. The stack space of thread and the
per-thread data is stored in program's memory space. When first create the thread, the most of
structures are created and initialized. In order to creating the low-level thread, a function or method to
act as the main entry point for thread is needed, then one of the available thread routines has to be used
to start the thread. The thread can be created by using the different methods as using NSThread, POSIX
Threads, or using NSObjec to spawn a thread. After a thread is created, different thread environment
needed to be configured, like configuring the stack size of a thread and the thread-local storage, setting
the detached state of a thread and the thread priority.
4.2 Interrupt
An interrupt is an indication to a thread that it should stop what it is doing and do something else. It's up
to the programmer to decide exactly how a thread responds to an interrupt, but it is very common for the
thread to terminate.
a. Android
In Android, signal is a blocking I/O operation has been interrupted. The number of bytes that were
transferred successfully before the interruption took place is stored in a field of the exception. Lock
implementations provide more extensive locking operations than can be obtained using synchronized
methods and statements. They allow more flexible structuring, may have quite different properties, and
may support multiple associated Condition objects. As interruption generally implies cancellation, and
checks for interruption are often infrequent, an implementation can favor responding to an interrupt over
normal method return. This is true even if it can be shown that the interrupt occurred after another
action may have unblocked the thread. An implementation should document this behavior.
Most device drivers never need to take primary interrupts because their interrupt lines don’t cascade into
the system’s interrupt controller. For example, FireWire and USB devices have a notion of interrupts, but
are really just messages on a serial bus. These are commonly referred to as software interrupts because
apart from the interrupt caused by the message itself, the interrupt is entirely simulated in software.
4.3 Inter-process communication
a. Android
In Abdroid’s computing, the Inter-process communication (IPC) is a set of techniques for the exchange of
data among multiple threads in one or more processes. Processes may be running on one or more
computers connected by a network. IPC techniques are divided into methods for message passing,
synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary
based on the bandwidth and latency of communication between the threads, and the type of data being
b. iPhone
For iPhone, any time the sequence in which two operations are completed affects the result, there is the
potential for a race condition. For example, if two processes (in a single program or different programs)
share the same global variable, then there is the potential for one process to interfere with the other or
for an attacker to alter the variable after one process sets it but before the other reads it. The solution to
race conditions of this type is to use some locking mechanism to prevent one process from changing a
variable until another is finished with it. There are problems and hazards associated with such
mechanisms, and they must be implemented carefully.
4.4 System calls
A system call is a request made by any program to the operating system for performing tasks—picked
from a predefined set—which the said program does not have required permissions to execute in its own
flow of execution. System calls provide the interface between a process and the operating system.
a. Android
Developer can trace the system calls invoked by Android for specific tasks by Android Task. The developer
have to figure out which process is actually managing the data items, and then use strace <app name>
after start to strace an application. It can also attach to an existing process by using the command 'strace -
p <pid>'. Use 'ps' to find the process which is managing the contacts and messaging.
The iPhone OS provides tools for system profiling. The Shark application lets user selectively find out what
file system-related function calls the application makes. When user set up the session configuration, he
can tell Shark exactly which function calls you want it to watch. A list of system calls includes all the file
I/O calls plus fcntl, flock, fstat, fsync, link, lstat, lstatv, and stat. The sc_usage tool displays an ongoing
sample of system statistics for a given process, including the number of system calls and page faults. The
tool adds new system calls to the list as they are generated by the application being watched. The counts
displayed are both the cumulative totals since sc_usage was launched and the delta changes for this
sample period.
4.5 Memory management
Memory management is the programming discipline of managing the life cycles of objects and freeing
them when they are no longer needed. Managing object memory is a matter of performance; if an
application doesn’t free unneeded objects, its memory footprint grows and performance suffers.
a. Android
Android applications usually are limited to 16 MB of heap. Though it is very little for some developers, it is
a lot of memory for a phone. Because the more applications Android can keep in memory, the faster it will
be when user switch between its applications. Therefore, the applications should use as little memory as
possible to guarantee multiple applications run without getting killed. The memory leak phenomenon
affects the memory usage, and hence affects the application switch efficiency. All Android apps are
written in Java. Java, unlike other programming languages, does not require any coding to allocate or
deallocate memory and handles all memory allocation/deallocation through a "feature" called automatic
garbage collection. The garbage collector kicks in whenever an application no longer has any active
threads pointing to it. By design, the garbage collector will not remove applications that are actively being
used; but there may be a bit of system degradation while things are being cleaned up (usually a very fast
process). Android rely on automatic memory management which handled by garbage collector. However,
the garbage collector can sometimes cause performance issues if memory allocation is not handled
carefully. The Android SDK provides allocation tracker, a tool to avoid the frequent garbage collection.
iPhone has no garbage collection, developer has to clean up the variables after use them, otherwise the
program will leak memory. Though NSObject class has accounting stuff help to keeps the track of how
many other objects are currently using the object, but it is not automatic and developers have to adjust
that by themselves. The rule for managing memory is to make sure the number of ownership methods
called on an object will equal the number of loss-of-ownership methods by the time the program has
finished executing. When create or copy an object, its retain count is 1. Thereafter other objects may
express an ownership interest in your object, which increments it’s retain count. The owners of an object
may also relinquish their ownership interest in it, which decrements the retain count. When the retain
count becomes zero, the object is deallocated (destroyed).
4.5 Networking support
Wi-Fi: Wi-Fi is the IEEE 802.11 standard, is a two-way, short range protocol and operates in two bands.
Initially, all Wi-Fi used 2.412-2.472 GHz. The 802.11n protocol added the ability to use 5.15 to 5.25 GHz
(indoor use), but the iPhone is restricted to 802.11b/g. The networking stack in iPhone OS includes several
interfaces over the radio hardware of iPhone and iPod touch devices. The main programming interface is
the CFNetwork framework, which builds on top of BSD sockets and opaque types in the Core Foundation
framework to communicate with network entities. Android comes with a complete support for the Wi-Fi
connectivity. The main component is the system-provided WiFiManager. As usual, user obtain it via
getSystemServices() call to the current context. Once they have the WiFiManager, they can ask it for the
current Wi-Fi connection in form of WiFiInfo object. Also they can ask for all the currently available
networks via getConfiguredNetworks(). That gives the list of WifiConfigurations.The WiFiScanReceiver is
registered by WiFiDemo as a broadcast receiver to be invoked by the system when new Wi-Fi scan results
are available. WiFiScanReceiver gets the callback via onReceive(). It gets the new scan result from the
intent that activated it and compares it to the best known signal provider. It then outputs the new best
network via a Toast.
Bluetooth: Bluetooth is a two-way, ultra short range protocol that works in the 2.40-2.485 GHz band. It
avoids interference with other systems in the same band by being very low power, about a milliwatt, and
has a maximum range of about 10 meters. The Android platform includes support for the Bluetooth
network stack, which allows a device to wirelessly exchange data with other Bluetooth devices. The
application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs.
These APIs let applications wirelessly connect to other Bluetooth devices, enabling point-to-point and
multipoint wireless features.
3G: iPhone 3G(S) is a "quad-band phone" which means it can also operate on the GSM 900 and GSM 1800
frequencies used in Europe. 3G technology gives iPhone fast access to the Internet and email over cellular
networks around the world. With support for 7.2Mbps HSDPA, iPhone 3GS also makes it possible to do
more in more places: Surf the web, download email, get directions, and watch video — even while user is
on a call. Since iPhone seamlessly switches between EDGE, faster 3G, and even faster Wi-Fi, user can
always get the fastest connection available. Users can even share their Internet connection with laptop
via Internet tethering.
4G: 4G refers to the fourth generation of cellular wireless standards. It is a successor to 3G and 2G
standards, with the aim to provide a wide range of data rates up to ultra-broadband (gigabit-speed)
Internet access to mobile as well as stationary users. Sprint openly confirsm plans to sell a 4G Android
smartphone next year. 4G aptly called MAGIC (Mobile multimedia, Anytime/any-where, Global mobility
support, Integrated wireless and Customized personal service) provides for data rates of up to more than
100Mbps for the mobile users. This WiMax-connected device will run three or five times faster than the
3G-connected iPhone (on a good day), and will feature a bunch of apps that fully exploit that speed.
Verizon Wireless said earlier this year that they see the Apple iPhone on their 4G network in 2010. A
rumor about Verizon and Apple already testing a new iPhone on the Verizon Wireless 4G LTE network
sneaked its way through the Motorola Droid coverage over the weekend.
4.6 Power Management
Android supports its own Power Management (on top of the standard Linux Power Management)
designed with the premise that the CPU shouldn't consume power if no applications or services require
power. Android requires that applications and services request CPU resources with "wake locks" through
the Android application framework and native Linux libraries. If there are no active wake locks, Android
will shut down the CPU. The Android Framework exposes power management to services and applications
through the PowerManager class. User space native libraries should never call into Android Power
Management directly. Bypassing the power management policy in the Android runtime will destabilize the
system. All calls into Power Management should go through the Android runtime PowerManager APIs.
iPhone do not have the power management toolkit as Mac OS does. Instead, this function is embedded
into the core layer, which intelligently powers up planes of devices as the system goes into standby or to
sleep. The most power hungry systems in iPhone from most to least are 3G radio system, Wi-Fi, 2G radio
system, Bluetooth and GPS. Reduce the number of power consuming applications helps to save the
energy. When put an iPhone into sleep, it will disconnect from network, turn off the Wi-Fi and screen
4.7 Development kit
The Android Software development kit includes a comprehensive set of development tools which include
debugger, libraries, documentation, sample codes and tutorials. The SDK support the development
platforms with x86-architecture computers running Linux, Mac OS X, Windows XP and Vista. The SDK also
requires to development environment have Java Development Kit, Apache Ant and Python. Eclipse with
Android Development Tools Plug-in is the official integrated development environment (IDE) for Android
The Android 0.9 SDK beta was released on 18 August 2008. It provides an updated and extended API,
improved development tools and an updated design for the home screen. The version 1.0 Android SDK
was released on 23 September, it had fixed the main bugs and made several API changes from the 0.9
version. Google released the Android SDK version 1.1 on 9 March 2009. Version 1.1 includes the update
for supporting search by voice, priced applications, alarm clock fixes, fixes mail notification and so on. It
also made the update that the Dev phones can access paid applications and developers can see them on
the Android Market. The SDK versions 1.5 and 1.6 were released on May 2009 and September 2009
respectively. They support many new features like video recording, voice recognition, battery usage
indicator and VPN control applet.
With this software the programmer can develop applications that run on iPhone and iPod touch, Including
the Xcode IDE, Instruments, iPhone simulator, frameworks and samples, compilers, Shark analysis tool,
and more. With over 1,000 new APIs, iPhone SDK provides developers with a range of new possibilities to
enhance the functionality of their applications. New APIs also provide support for applications to
communicate with hardware accessories attached to iPhone or iPod touch. The SDK requires an Intel Mac
running Mac OS S Leopard or later, other operating systems like Microsoft Windows and older version of
Mac OS X are not supported.
5 Comparison
5.1 Development Environments
The Android use java as develop language. With Android’s support for multiple processes and component
reuse, the platform itself provides support for Intents and Activities (an intent is just a variant of a
command) and provides a way of declaring user preferences in XML which is extensible allowing custom
UI components to be integrated. Android development leverages the excellent JDT tools, everything Java
is indexed, the IDE has a rich model of the source code, and refactoring is seamless. JDT's incremental
compiler provides immediate feedback with errors and warnings as you type. In Android, UI builder can’t
display UIs how they’ll actually appear.
iPhone uses Objective-C as its development language. Eclipse can be used as iPhone OS development IDE.
Beside, Aptana, a cross-platform IDE has released their iPhone Development Plug-in for their Ajax IDE. It
can preview pages in both horizontal and vertical mode, and includes a wizard for importing the most
common Ajax libraries. iPhone application developers are given a good UI builder; It’s flexible and can
model some sophisticated UIs, ease to port third party applications.
5.2 Reliability and Security
Android is a multi-process system, in which each application (and parts of the system) runs in its own
process. Most security between applications and the system is enforced at the process level through
standard Linux facilities, such as user and group IDs that are assigned to applications. Additional finer-
grained security features are provided through a "permission" mechanism that enforces restrictions on
the specific operations that a particular process can perform, and per-URI permissions for granting ad-hoc
access to specific pieces of data. As an open platform, Android allows users to load software from any
developer onto a device. As with a home PC, the user must be aware of who is providing the software
they are downloading and must decide whether they want to grant the application the capabilities it
requests. This decision can be informed by the user's judgment of the software developer's
trustworthiness, and where the software came from.
The iPhone has no security software and Apple doesn't let people load third-party programs on the device,
which could reduce the risk of infection from malicious software. When the iPhone is connected to the
Web, dangerous possibilities emerge. The iPhone Auto-Lock disables the device's screen after a preset
time period of non-use, and the Passcode Lock feature takes that a step further. Whenever the device's
display locks, whether due to Auto-Lock or because you've hit the iPhone Sleep button--found on the top
right of the device--Passcode Lock requires a four-digit code to be entered before the device can be
employed again. With the password failure actions, it’s possible to configure an iPhone to perform a soft
reset, lock the device, or wipe all the data after a pre-configured number of failed login attempts. If a user
forgets his or her password, the device can be unlocked using a remote unlock service. The iPhone OS
security APIs are located in the Core Services layer of the operating system and they are based on services
in the Core OS (kernel) layer of the operating system. Applications on the iPhone call the security services
APIs directly rather than going through the Cocoa Touch or Media layers. Networking applications can
also access secure networking functions through the CFNetwork API, which is also located in the Core
Services layer.
The iPhone OS security implementation includes a daemon called the Security Server that implements
several security protocols, such as access to keychain items and root certificate trust management. The
Security Server has no public API. Instead, applications use the Keychain Services API and the Certificate,
Key, and Trust services API, which in turn communicate with the Security Server. Because, unlike the Mac
OS X security services, the iPhone OS security services do not provide an authentication interface, there is
no need for the Security Server to have a user interface. Although Mac OS X includes a low-level
command-line interface to the OpenSSL open-source cryptography toolkit, this interface is not available
on the iPhone OS. For iPhone OS development, use the CFNetwork API for secure networking and the
Certificate, Key, and Trust Services API for cryptographic services.
5.3 Virtualization
Every Android application runs in its own process, with its own instance of the Dalvik virtual machine.
Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in
the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-
based, and runs classes compiled by a Java language compiler that have been transformed into the .dex
format by the included "dx" tool. The Dalvik VM relies on the Linux kernel for underlying functionality
such as threading and low-level memory management. Unlike most virtual machines and true Jave VMs
which are stack machine, the Dalvik VM is a register-based architecture. Like the CISC vs. RISC debate, the
relative merits of stack machine vs. register-based approaches is a subject of continual argument.
Generally, stack-based machines must use instructions to load data on the stack and manipulate that data,
thus, require more instructions than register machines to implement the same high level code, but the
instructions in a register machine must encode the source and destination registers and, therefore, tend
to be larger. This difference is primarily of importance to VM interpreters for whom opcode dispatch
tends to be expensive and other factors are relevant for JIT compliation.
A tool called dx is used to convert Java .clasee files into the .dex format. Multiple classes are included in a
single .dex file. Duplicate strings and other constants used in multiple class files are included only once in
the .dex output to conserve space. Java bytecode is also converted into an alternate instruction set used
by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a
compressed .jar (Java Archive) derived from the same .class files.
The Dalvik executables may be modified again when they get installed onto a mobile device. In order to
gain further optimization, byte order may be swapped in certain data, simple data structures and function
libraries may be linked inline, and empty class objects may be short-circuited, for example.
Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate
it from other standard VMs: The VM was slimmed down to use less space. Dalvik currently has no just-in-
time compiler, but Android 2.0 includes experimental source for one (disabled by default). The constant
pool has been modified to use only 32-bit indexes to simplify the interpreter. It uses its own bytecode, not
Java bytecode. Moreover, Dalvik has been designed so that a device can run multiple instances of the VM
For iPhone, Sun Microsystems plans to release a Java Virtual Machine (JVM) for iPhone OS, based on the
Java Platform, Micro Edition version of Java. This would enable Java applications to run on iPhone and
iPod Touch.
6 Conclusion
Table 1 compares features between iPhone 3.0 and Android.
Table 1 iPhone 3.0 vs. Android
MMS Support
Copy/Cut and Paste
Application Notification
Phone-wide Search
Email Search
Calendar Search
3G Tethering
Voice Over IP
File Sharing
Peer to Peer Bluetooth Connectivity
iPhone 3.0
Push Notifications
Background Processes
Yes(Gmail search box)
Yes(3 -party app)
Yes(3 -party app)
Compare with iPhone, Android provides developer more freedom. As Android is an open source,
developer can create and deploy anything on the device. Compare with iPhone OS, Android is more
widespread and applied in different model. Besides, Google provides many services like Google Search,
gTalk, Google Doc, Google Map and so on. Once integrate these services with Android, it can provide
customer more benefits.
iPhone OS, on the contrary, is designed exclusively for Apple’s products, like iPhone, iPod and iPad. This
helps to avoid reduce the functionality to suit the hardware needs for different devices. Also this focus
can help developers make more useful and powerful applications based on customers requirement.
Greg Kroah-Hartman. "Android and the Linux kernel
"Linux developer explains Android kernel code removal".
"What is Android". Android Developers.
Open Handset Alliance. "Industry Leaders Announce Open Platform for Mobile Devices".
Bort, Dave. "Android is now available as open source". Android Open Source Project.
Honan, Matthew. "Apple unveils iPhone". Macworld.
7. Android architecture.
8. An overview of iPhone OS architecture.
10. Into Mobile.

Friday, July 22, 2011

Multiple APK Support in Android Market

Posted by Dirk Dougherty on 21 July 2011 at 1:45 PM

[This post is by Eric Chu, Android Developer Ecosystem. —Dirk Dougherty]

At Google I/O we announced our plans to add several new capabilities to help developers manage their products more effectively in Android Market. We’re pleased to let you know that the latest of those, multiple APK support, is now available. Multiple APK support is a new publishing option in Android Market for those developers who want extra control over distribution.

Until now, each product listing on Android Market has included a single APK file, a universal payload that is deliverable to all eligible devices — across all platform versions, screen sizes, and chipsets. Broad distribution of a single APK works very well for almost all applications and has the advantage of simplified product maintenance.

With multiple APK support, you can now upload multiple versions of an APK for a single product listing, with each one addressing a different subset of your customers. These APKs are complete, independent APKs that share the same package name, but contain code and resources to target different Android platform versions, screen sizes, or GL texture-compression formats. When users download or purchase your app, Android Market chooses the right APK to deliver based on the characteristics of the device.

When you upload multiple APK files, Android Market handles them as part of a single product listing that aggregates the app details, ratings, and comments across the APKs. All users who browse your app’s details page see the same product with the same description, branding assets, screenshots, video, ratings, and comments. Android Market also aggregates the app’s download statistics, reviews, and billing data across all of the APKs.

Multiple APK support gives you a variety of ways to control app distribution. For example, you could use it to create separate APKs for phones and tablets under the same product listing. You could also use it to take advantage of new APIs or new hardware capabilities without impacting your existing customer base.

To support this new capability, we’ve updated the Developer Console to include controls for uploading and managing APKs in a product listing — we encourage you to take a look. If you’d like to learn more about how multiple APK support works, please read the developer documentation. As always, please feel free to give us feedback on the feature through the Market Help Center.

Tuesday, July 19, 2011

How can I setup a remote connection to MySQL?

To remotely connect to your MySQL databases, you must have an I.P.-based account. Login to your control panel and click on the side menu "ValueApps" then the "Database" tab. If you have not installed MySQL, click on "MySQL Database" under Available ValueApps. If you have already installed MySQL, click on "MySQLs" under Installed ValueApps. Check the box "TCP/IP Connection". Now login to your account via SSH.
Use the MySQL monitor to grant privileges.
Start the MySQL monitor with this command:
Your shell prompt should now look like this:
Run this command:
USERNAME is the username that you would like to create.
IP is the public IP address of your remote connection. See examples
PASSWORD is the password you would like to use for this username. You now must flush MySQL's privileges. Run this command:
Run this command to exit MySQL:
You can find your I.P. address by visiting these sites(opens a new window):

Connecting to remote MySQL database

MySQL db can be connected from a  remote location. Say at A mysql is running and from B I am trying to connect.
At A I have created a user for remote access like this .
Opened the dos prompt and gone to c:>cd mysql/bin
c:>mysql>cd bin
c:>mysql> mysql --user=root  --password=mypassword
Here welcome message will appear. and then this line of SQL will grant previlage to remote user
grant select,insert,update, delete on db_name.* to user_name IDENTIFIED BY "user_password";
Here if the user has to be given remote access ( say from coumputer B ) then this should be
grant select,insert,update, delete on db_name.* to user_name@B IDENTIFIED BY "user_password";
This will allow remote access to user user_name from computer B.  At computer B the server address can be the IP address of A and the user id and password will be same .

Friday, July 15, 2011

Setting up Stratos locally in your home computer is just a few steps away ..

Now you can check out the trunk code of Carbon from the repository, build, and configure WSO2 Stratos in a few steps.
Check out
mvn clean install from carbon directory

Set up the following in ~/.bashrc (change the values accordingly for the email addresses, carbon directory, the transport sender, and the other information given below.)
# Stratos setup constants
export stratos_local_ip=""

export CARBON_DIR="/home/pradeeban/trunk/stratos/carbon"
export STRATOS_DIR=$CARBON_DIR/stratos_home
export SSO_ENABLED=true
export CREATE_DB=true
export STRATOS_MAIL_TRANSPORT=' ********.***.***25 false false '

If you are going to use the stratos binaries, you can use the downloaded packs, usually available from the builders online, as of the trunk or development branch version or from the download area, for a released version.

Place the downloaded zips in to a location and also define that location in bashrc profile.
export PACKS_DIR="/home/pradeeban/Downloads"

Now you may run the set up script as above.

Running Stratos Set up script - carbon/build/

Add the following lines to your /etc/hosts file

Start all the Stratos services
from $stratos_home
sh start all

Stop all the Stratos services
form $stratos_home
sh stop all

Also you can start and stop the services individually or as a chosen subset of all the available services.

Here by pointing the browser to, you can access Stratos Manager. Pls note that in the configuration we have enabled SSO. You can also set up the Stratos services with SSO disabled instead, by setting export SSO_ENABLED=false,above in .bashrc profile. 

Configuring WSO2 BAM to connect to different Databases

Connecting to mySql database.

1. You need to execute the mysql.sql in BAM_HOME/dbscripts folder.

- Navigate to where you have the above script.
- Login to MySQL as the root user.
mysql -u root -p
- give the password at the prompt

- Execute the mysql.sql script.
source mysql.sql

This will create the BAM database. To connect to the database you need to:

2. Copy the mysql driver to CARBON.
- Navigate to BAM_HOME/repository/components/lib and copy mysql-connector-java-5.1.7-bin.jar.

3. Update BAM_HOME/repository/conf/ with your database information. A sample is done below.

Connecting to Oracle database

1. You need to execute the oracle.sql in BAM_HOME/dbscripts folder.

- Login to SQLPlus as a sysdba and create the db user and grant required access.
$sqlplus sys as sysdba; 

SQL> startup
drop user wso2bam‎ cascade; 
Create user wso2bam‎ identified by wso2bam account unlock; 
grant connect to wso2bam; 
grant create session, dba to wso2bam;

Now login from the above created user and execute the oracle.sql script

sqlplus wso2bam/wso2bam@

This will create the BAM database. To connect to the database you need to:

2. Copy the mysql driver to CARBON.
- Navigate to BAM_HOME/repository/components/lib and copy ojdbc14.jar.

3. Update BAM_HOME/repository/conf/ with your database information. A sample is done below.

Activity monitoring using WSO2 BAM Server

In this scenario we will be monitoring requests and responses passed through a proxy service in WSO2 ESB. The proxy service is calling an in/out operation in an Axis2Service in WSO2 WSAS.

Lets make the setup.

A) Deploy the axis2 service in WSO2 App Server.

1. Download WSO2 App Server-3.2.1 distribution from here and extract it.

In this setup we are going to have 3 WSO2 servers running at the same time. Therefore, we need to change the http/https ports of each server to make the servers start in different ports. To do this go to the CARBON_HOME/repository/conf and update the http/https ports in mgt-transports.xml and axis2.xml files.

2. Start WSO2 App Server distribution by running the startup scripts in WSAS_HOME/bin/.
$ sh in Ubuntu and
$ wso2server.bat in Windows.

3. Once the server is started, Sign-in to admin console and go to Services >Add >Axis2Service and upload this service.

Now we have WSO2 WSAS waiting with a service in it at Let's setup WSO2 ESB.

B) Configure WSO2 ESB

1. Download a WSO2 ESB-3.0.1 distribution from here and extract it. Change its ports and start the server as instructed above.

2. Once the server is started, Sign-in to admin console and go to Manage > Service Bus > Source View. Paste the following configuration into the source view.

<proxy name="DemoProxy1" transports="https http" startOnLoad="true" trace="disable" statistics="enable">
            <endpoint name="endpoint_act">
                <address uri="" statistics="enable"/>
            <inSequence statistics="enable">
                    <property name="IN" value="*********IN****************"/>
        <publishWSDL uri=""/>

NOTE: You may need to chnage the endpoint epr according to your network settings.

C) Add publisher jars to ESB.

We need to enable Activity Publishing in ESB. Since ESB doesn't have activity publishing feature in it by default, we need to add the relevant jars manually.
So download following & and copy to ESB_HOME/repository/components/dropins/ folder. This will add 'Activity Publishing' menu to ESB admin console under Configure menu.

Also we need to update the in ESB_HOME/repository/components/plugins with this patched version.

Lastly we need to enable message tracing in ESB. Open ESB_HOME/repository/conf/carbon.xml and add this;

In the next step access ESB UI and enable message tracing. Sign-in to ESB admin console, navigate to 'Activity Publishing. In the 'Activity Publisher Configuration' page enable message tracing, go to Activity Publishing and enable eventing.
Message Threshold will be set to 2 by default. This is the minimum number of messages you need to have in the que before being read by a subscriber.
Enable 'Message Dumping' and 'Message Lookup'. Xpath expression is the value from which your message will be filtered for the subscriber.

After configurations on ESB side is done, we need to configure WSO2 BAM to monitor messages from and to ESB.

D) Configure BAM

1. Download WSO2 BAM-1.2.0 distribution from here and extract it. Change its ports and start the server as instructed above.

NOTE: BAM is configured to use H2 database by default. If you want to connect to oracle, mySql or an MS SQL db you need to create the database by running a script and update driverClassName,url, username, password in file which resides in BAM_HOME/repository/conf. Details of configuring to other DBMSs are explained here.

2. Now start WSO2 BAM server and sign-in to the admin console.

3. Navigate to Configure > Monitored Servers > Add Servers.

4. Add the server information of your ESB server, which we are going to monitor. Since we are monitoring mediation, our data collection method should be 'eventing' and type of data thats traced will be 'message'. So the coonfiguration is:

Server URL : https://<server IP>:<server port>
Data Collection method : Eventing
Type of data : Messagega
User Name : user name for ESB
Password : Password for ESB

After this you will have an entry in the 'Monitored Servers' with the information you gave above.

E) Monitor the messages

1. Using a client send messages to the proxy service we created above. i am using following java client.

*Copyright (c) 2005-2010, WSO2 Inc. ( All Rights Reserved.
*WSO2 Inc. licenses this file to you under the Apache License,
*Version 2.0 (the "License"); you may not use this file except
*in compliance with the License.
*You may obtain a copy of the License at
*Unless required by applicable law or agreed to in writing,
*software distributed under the License is distributed on an
*KIND, either express or implied.  See the License for the
*specific language governing permissions and limitations
*under the License.

package org.wso2.carbon.test;

import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;

import javax.xml.namespace.QName;

public class EsbDemoProxy {

    private static EndpointReference targetEPR = new EndpointReference(

    public static OMElement echoPayload(String x) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("", "example");
        OMElement method = fac.createOMElement("echoInt", omNs);
        OMElement value = fac.createOMElement("x", omNs);
        value.addChild(fac.createOMText(value, x));
        return method;

    public static void main(String[] args) throws AxisFault {

        // creates a new connection manager and a http client object
        MultiThreadedHttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
        HttpClient httpClient = new HttpClient(httpConnectionManager);
        for (int a = 0; a < 1; a++) {
            for (int i = 0; i < 1; i++) {
                ServiceClient sender = new ServiceClient();
                try {
                    OMElement payload1 = EsbDemoProxy.echoPayload("55");
                    Options options = new Options();

                    OMFactory omFactory = OMAbstractFactory.getOMFactory();
                    OMElement omElement = omFactory.createOMElement(new QName("", "BAMEvent", "ns"), null);
                    omElement.addAttribute("activityID", "AAAAIsiasd-sdswodi-2329", null);

                    OMElement bampropertyElement = omFactory.createOMElement(new QName("", "Property", "ns"), null);
                    bampropertyElement.addAttribute("name", "ESB2_a", null);
                    bampropertyElement.addAttribute("value", "A", null);



                    OMElement result1 = sender.sendReceive(payload1);
                    String response1 = result1.getFirstElement().getText();

                } catch (Exception e) { // (XMLStreamException e) {
                finally {
                    if (sender != null) {
                        try {
                        } catch (Exception e) {

                        try {
                        } catch (Exception e) {


2. After sending few messages you will be able to observe the messages from the BAM Admin Console > Main Dashboard > Actvity Tab