Novoda at London Mobile Week

Some loved the wearable build bot more than others.

Over the Air - 30th September & 1st October
Jamie was speaking about ubiquitous Android at Over The Air on the Friday. The rest of the Novoda team were there for the hackathon too. We came armed with a whole bunch of ideas and a pack of NFC stickers! Hooray we won stuff! I ended up making an app which won the Secure Communications Challenge with an NFC enabled encryptor for your secret messages and the guys won the most wearable hack for a wearable build status bot.

To I’m participating in Planet of the Apps – 4th–7th October in a panel discussion on the first conference day: ‘Can the browser app be the killer app’

And then the biggie… we’re organising and Carl’s speaking at Droidcon UK – 6th & 7th October. Carl will be presenting his talk about Android’s message-driven architecture. The whole Novoda team will be in attendance just kicking about. See you there!

A little further in the future, some of us will be at Droidcon Netherlands on the 22nd & 23rd November.

1 Comment

Live Wallpapers part 1 – Animated Live Wallpaper

Live wallpapers serve up an impressive introduction to Nexus Ones. Introduced in Android 2.1, these dashboard backgrounds have the advantage of being able to interact with a device programatically.  To celebrate receiving our Nexus Ones at a Londroid / Google Android developer lab have excitedly created some quick LiveWallpapers demos we’d like to share.

Animated LiveWallpaper

Live Wallpapers offer unique screen real estate over widgets and a chance to show off some dashboard visuals. Childhood memories have instilled a message of freedom into the image of a Testerrossa speeding down an open road with a pretty girl ala “Ferris Buellers day off” and Sega’s classic “Outrun”. So What better to express the open platform than an OutRun inspired Live Wallpaper?

A sexy implementation using the openly available github source code:

Download the outrun livewallpaper for the Nexus One
Scenery changes every time the phone is sleeping as you can see here, here and here, in awful quality.

Admittedly my graphics aren’t quite as inspiring.

Demo graphics

Download Demo apk compiled for a Nexus One

Animated LiveWallpaper Notes

Src code for Demos projects on Github:
Switch Image on left/right
Switch Animation on left/right

A Live Wallpaper consists of an ‘Engine’ and a ‘Service’. The engine specifies how your wallpaper is rendered while it’s service creates instances for the home screen. A wallpaper service differs from a normal service in addition of  OnEngineCreate(). This has been the first time I’ve used the canvas extensively and I learned you first must lock the canvas and choose which region you wish to redraw. onVisibilityChanged() or onSurfaceChanged() will read much like the instructions of how to draw your canvas from empty. Onvisibility() will first change to true in rendering your wallpaper  preview and this will return false when your wallpaper falls out of view and you transition to your dashboard. This is a handy function as every time your wallpaper falls out of view you can stop everything you are doing and free up the associated resources.

To update the drawn canvas state you need to tell the UI to refresh via a handler. In my case I needed to request an indexed image from within an collection upon each draw, Each time the handler returns back I update my drawn bitmap with a frame from the animation. It should be noted here that you should only be keeping the image Resource IDs in memory rather than the actual binary contents of the images. I was at first doing this, following a demo I downloaded but I soon ran into this error at runtime:

ERROR/AndroidRuntime(1067):
Uncaught handler: thread main exiting due to uncaught exception
java.lang.OutOfMemoryError: bitmap size exceeds VM budget

This is because all of the png images although starting out quite small, when transformed to bitmaps upon interpreation they become a lot larger and quickly fill up the allotted memory allocation. Instead I just kept an array of resIds using res.getIdentifier(). This seems pretty good in the performance stakes.

I chose to play an animation for left and right steering when a user flicks between panels. I kept track of this via the onTouchEvent()’s ACTION_DOWN and then checking which side of the screen their ACTION_UP was upon. The reason I added a timer in there was to add a little delay for the animation so you can appreciate the perfect driving line of the Testerossa.An area that I would like to return to is recognising when the user’s finger has dragged the screen a certain distance. My original approach to recognising significant drag was to monitor the start and end points and see if they lay at different sides of the screen, I have since learned measuring the distance within onOffSetsChanged would probably be a more reliable approach.

The last thing of note with Live Wallpapers is that they have a convenience listener for dropping icons and tapping on the dashboard screen via sendWallpaperCommand() and then acting on the input via onCommand(), these could also be very useful and are used to good effect in the demos with water droplets and colours.

At the moment it seems like the wallpaper is a bit of a memory hog and I’d like to find out why. Any suggestions are appreciated.
We think that the problem is in the BitmapFactory.decodeResources() function recreating the Bitmap every time. In order to get around this I think the best way would be to create a ’spriteSheet’ then move around the area of this big sheet masking it to only the area I need like one of those revolving wheels that show the horse running. Live and learn, I always wondered why people used sprite sheets in games programming I guess this must be one of the reasons.

As a side note, if anyone has any information on how The Nexus One splash screen is able to read in it’s splash screen consisting of 97pngs (/system/media/bootanimation.zip) I’d love to hear how they achieved this. When developing ideas for your Live Wallpapers consider trying to include the interaction of forces particular to the context of a mobile device such as time, movement and position.

Android SDK at time of writing was: android-sdk-mac_x86-2.1 ( SDK version 7 )

Citations & Research

1 Comment

Mobile World Congress Schedule 2010

Annual since 1987, Mobile world congress is the world’s largest exhibition for the mobile industry and with 47,000 in attendance last year, it’s safe to say that it’s worth mobile companies showing face. Since there is so much happening that week it makes sense to plan well ahead of schedule. Everyone has been sharing lists of events and excited talk but no maps. So I thought it might be worth me throwing in my plans in the hope that someone may benefit from my timings, maps and event lists. These timings are in no way guaranteed as a good judge of how you should spend your time but could help make sure you’ve not missed anything really beneficial. Most of my time is going to be spent in App planet but I really want to try and get around as many exhibition stands as I can in my rare few minutes in between. Feel free to say hello to me if you are in attendance. You can catch me on MotoDev’s panel of Android developers on Monday at 11:30am Hall 7.

WIP have very kindly developed an MWC attendance survival guide which I very much recommend if not just for the Exhibition floor plan.

Mobile World Congress 2010 address
Event Details – http://www.mobileworldcongress.com

View Larger Map

Sim Cards

To obtain a prepaid Spanish sim with 3G Internet I’ve been recommended Yoigo. You need photo ID and the address of your hotel to sign up. Remember to get itit on any day other than Sunday and shops close around 2pm to 4pm:

View Larger Map

Monday

09:00 – MotoDev – Breakfast at Motodev in AppPlanet – Hall 7
11:30 – MotoDev – Android Developer Panel – Hall 7
11:30 – MotoDev – Maximise your Android Market Opportunity – App Planet – Hall 7
12:15 – MotoDev – Lunch with the experts – App Planet – Hall 7
14:00 – Mobile premier awards – Palau De La Música 4 08003 Barcelona, Spain 932 957 200
21:00> – Mobile premier awards dinner – Bel-Luna Jazz Club & Restaurant

MotoDev

More MotoDev event details…
Not much has been mentioned in the Android pres about the motodev sessions but I for one am interested in the opinions of anyone developing plugins for my IDE. They have a bunch of sessions planned at MWC a few of which I’ll be attending.

Mobile Premier awards

View event details
To get to the mobile premier awards take the Espanya tube to Urquinaona then walk straight down the road: Carrer de les Jon que res

View Larger Map

Mobile premier awards dinner

RSVP for the dinner here
A swanky affair after the award ceremony which promises to be both an interesting and beautiful meal.

View Larger Map

Tuesday

08:30 – Opportunities with on-device payments and preloaded content – Tanla MWC Seminar
08:00 – UKTI – Challenges in Japan – Location Sala D
11:30 – UKTI – Turkish / UK Partnering Event – UKTI stand?
17:00 – Scottish Development International – Whisky Reception – Stand, 1E66
18:00 – GoMo – Incognito BAR, calle Fusina 6, 08003 Barcelona, Spain
18:00 – Androiders Dinner at MWC

The Tuesday looks like it will be quite businessy until the evening where a bunch of Androiders will be getting together informally to chat and get dinner. So there is no official page or anything like that, just turn up or message someone who you know will be there(I’m @kevinmcdonagh) and we’ll be glad to have you in acquaintance. The plan is to prey on the hospitality of GoMo and turn up for their free bar and food. This plan should work win/win since a bunch of Android experts will be going to meet with mobile businessy people.

GoMo
Event details – http://www.facebook.com/#!/event.php?eid=180379714149&ref=ts
Here are some directions to get from Mobile World Congress to the GoMo event. I’ll be taking the Espanya Tube to Jamuel:

View Larger Map

Wednesday

08:30 - UKTI – UK / US Panel discussion – UKTI?
09:00 - Android dev lab (Games Dev) – Hall7 App world, MWC
12:30 - Sony Ericsson talk – App world Hall 7
14:00 - Tech crunch Mobile 2010
18:00> - Android cocktails – B Hotel in Gran Vía 389-391, Barcelona (next to MWC congress grounds)
18:30> - Swedish beers – Dostrece, carme 40, 08001, barcelona, Spain , 933017306
19:00> - Carnival of nations party – 7 Sins Bar, Muntaner 7, Barcelona, Spain

There is so much happening on the Wednesday sacrifices will have to be made. I’m really excited to get close to the participants of the Android developer session and get some basic questions out the way from the best in class. I do not currently plan to attend the Tech crunch event as I will instead be using the time to take part in Sony Ericsson’s training sessions. I’m also really looking forward to meeting the Barcelona user group at the Android Cocktails, I’ll have to split my time between this and Swedish beers which will inevitably be more businessy but essential.

Android Cocktails
Event detailshttp://eventuo.com/event/HN9foG5u6NI
An informal get together with the Barcelona Androids located beside MWC in the Nuñez i Navarro B Hotel

View Larger Map

Swedish Beers
Event Detailshttp://swedishbeers.blogspot.com/
A small scale yet still international event for businesses interested in mobile.
To Swedish Beers from the Android Cocktails event take the Espanya metro to Liceu:

View Larger Map

WIP Carnival of Nations party
Event Detailshttp://wipjam.com/party-carnival-of-nations/
In the unlikely event that I’ll have time to get to the Carnival of Nations event it is only 10mins walking distance away: Walking round the corner 10min away:


View Larger Map

Thursday

08:00 - GetJar Demo – App Planet Auditorium, Hall 7, FIRA, Barcelona, Spain
9ish -  WIP Jam – App Planet Auditorium, Hall 7, FIRA, Barcelona, Spain
11:45 – Join people Luncheoning form WIP – Hall 7
15:30 – More WIP Networking type interaction – Hall 7
18:00> Londroid – London Android Meetup

I’m obviously going to give the London Android Meeting a miss this time and instead I’ll be trying to make new WIP friends. Thankfully I can spend the whole day in the same place so no need for running to different locations.

2 Comments

Key Dates and projects beginning 2010

2010 promises to be an interesting year for Android. Starting off on the right foot I’d like to share some key dates and projects of general interest with everyone.
If there are any other events on the horizon we’d love to know about them so please get in touch and share.

Community Calendar

The closest thing a a community calendar in the Android world is the one started by a bunch of blogger sites including androidguys and anddroidandme
To subscribe to the community maintained Android global events calendar see here:
http://www.google.com/calendar/embed?src=g72pef2iiuu28hmedcnce5h0u4%40group.calendar.google.com&ctz=Europe%2FLondon&gsessionid=ycdhn2eV3gvznWmB8IIIlQ

Upcoming Android Related Events

Mobile World Congress (MWC), Barcelona
15 – 18th Feb
€599 – €4,999
http://www.mobileworldcongress.com
The world’s largest mobile event

Google IO, San francisco
May 19th & 20th
$400/$500/ student $100
http://code.google.com/events/io/2010/
Google’s annual global get together.


Londroid – The London Android meetup
Monthly, free
http://www.meetup.com/android
http://www.londroid.co.uk
Skillsmatter London
- Jan21, Feb18, Mar18, Apr22, May20, Jun17
Our fave monthy meeting. Very much recommended.

GeoMob
Monthly meetings, London 21Jan
http://gmdlondon.ning.com/

Droidcon Berlin, Nov? TBD £100
Droidcon London, Dec? TBD £100
Last year’s explicitly Android themed conference events. Dates will likely be announced within a few months.
http://www.droidcon.de/

Android Meetup Barcelona
16Feb (while MWC)
http://eventuo.com/of/barcelona-androides
A month;y get together in Barcelona. We’ll be attending the one held during MWC.

Android Stammtisch Berlin, C-base
http://www.android-in-berlin.de/
Jan 27, Feb 24
The monthly meetup held in Berlin’s excellent C-base hackspace.

JavaUserGroup
Monthly
http://jroller.com/javawug/

Chigago Android eco-challenge hacakthon
Feb 6th, $1
http://chigtug6.eventbrite.com/

Mobile Monday London
Monthly meetings
http://momolo.org/

FosDem, Brussels Belgium
6-7th Feb
http://fosdem.org/2010/

AppJam
http://www.meetup.com/App-Jam/

Mobile Geeks of London
Monthly meetup
facebook group

CTIA Wireless, Las vegas
March 23-25
http://www.ctiawireless.com/

WhereCampEU
March 12,13th
London
http://wherecamp.eu/

Podcasts

Androidguys – http://www.blogtalkradio.com/androidguys
Motodev – http://www.blogtalkradio.com/motodev
The Java Posse – http://javaposse.com/

Community hotspots

IRC – irc.freenode.net  – #android, #android-dev
The most active community channel for developers just generally getting together and chatting has been the IRC chat room from Android’s conception. A regular haunt for the members of Google’s Android team this chatroom is a the closest thing to a point of contact with the Android team.

Sites

Android neighbourhood – http://okmijnt.appspot.com/ – The AndroidNeighbourhood was started as an extension to the official android site listing all of the upcoming worldwide Android events.
Android and Me – Popular Android enthusiast website with good periodicals and reporting
planetandroid.com – The big daddy Android aggregator. If you watch one site for Android news, watch this one.
anddev.org – This forum has remained one of the most active communities in enthusiast Android development since the early betas
android-devices.net - nice source for upcoming Android devices.
androidbloke.co.uk – UK based news source
androidguys.com – A popular community for android developers and enthusiasts alike
Open intents Group – The chat group for Open intents

Projects

The most important open source projects are undoubtedly:
Open intents -  Open intents is a project to publically declare agreed standards for intents outside Google. The source repo for open intent projects is here: http://code.google.com/p/openintents/
and the open intents registry – http://www.openintents.org/en/intentstable ,
Open Android Alliance – http://code.google.com/p/open-android-alliance/

Although there has been very little movement from the open android alliance, open intents are very active.
Some notable other libraries that which we believe are useful:

Android – source.android.com
Commonsware – Lot of very interesting and useful Android projects including code for caching, tutorials and helpful Adapters.
Droid-fuA utility library for your daily Android needs
Calculon – Story based functional tests
Angle – an open GL game engine
Live Android – An Android Live OS CD for x86
Android x86 project – x86 ports
Android on Github – Mirror of Android repo
Phone Gap – Take advantage of platform specific features through a generic Javascript API

SignpostA light-weight client-side OAuth library for Java
RESTProvider - Automatically parses RESTful API responses into a Provider in Android
Maven-android-plugin maven build plugin for android, useful for continuous integration.
OAuth dashboard / providers – An OAuth Library/application for Android. Acts as a dashboard for users permissions that they have allowed/dissalowed to applications and for developers gives them an easy way to securely authenticate using a thirdparty android OAuth implementation.

Busybox – See here for how to install on Android. Adds chown, chgrp, awk, sed, grep, du, vi, pidof, less, tail, gunzip, gzip, tar, bzip2, clear, crontab, crond, diff, httpd, telnet, xargs, su, wget, which
DoomForAndroid – http://code.google.com/p/doom-for-android/ – Doom
androidscreencast – http://code.google.com/p/androidscreencast/ – Control an android device remotely

Twitter

Most popular twits: http://wefollow.com/twitter/android
A list of Android related people I think are worth following on twitter here: http://twitter.com/kevinmcdonagh/droids/members

4 Comments

Motion Sensors and Orientation in Android

An Activity can listen for changes in a device’s motion sensors by implementing the OrientationEventListener or SensorEventListener. The Listener’s onSensorChanged function will return units of measure differently depending on the axis of rotation. Each of the axes returned from the SensorEventListener are best interpretted by considering their roots in flight dynamics and how they would relate to a plane’s joystick in flight, where the android device would be the joystick.
Download the SensorEventListener Cheatsheet >>

X represents the ‘Azimuth’ which is the angle in current reference to Magnetic North. The units of measure are within 0-360 degrees imagining a complete rotation divided by 360 equal divisions. This is easiest interpretted by considering the device from a birds eye view and considering that this is the same response as you would expect from a compass.

Y or ‘Pitch’ is the degree to which the device is tilted forwards or backwards. The measure of pitch is zero when the device is lying flat, -90 when standing upright and 180 when lying flat on the device face. Realising that -90 is the value of the device upstanding and 90 being the value when it is upside down is initially confusing until you think about the aviation analogy. If a plane’s nose is dipping and the plane is losing height a pilot would pull upwards. The upwards values represent the increase in height as the pilot pulled back on the joystick. Using this analogy, holding the device and pulling backwards would increase the height and pushing forwards would decrease the height.

Z or ‘Roll’ is the rotation of the device in relation to the bottom left hand corner of the screen. The units returned represent the degree of change in degrees from 0 – +/-90. Zero is when the device is upright standing and forward facing. Any movement left or right will then increase or decrease to 90 or -90 and on to 0 when going past these values. Each quadrant within the clock face of rotation will progress 0 – 90. During flight a plane’s wings would ideally be aligned with the horizon and the cockpit would be upright at 90 degrees.

Initially dealing with data in this format can be a bit dis-orientating so if you only want to get the angle of the phone moving from an initial upright standing position use the OrientationEventListener. Otherwise the values returned form the SensorEventListener are the Y & Z representing the 0 – 90 degrees of rotation while the angle is passing through a certain quadrant within a full clock face of rotation while X units are returned in relation to Magnetic North.

The OrientationEventListener

The OrientationEventListener provides a much easier solution to detecting the phone’s current angle when you only need the angle of change from upright standing to left/right and around a clock face of rotation. Implementing this interface will enable you to access orientation as a simple int representing the rotation in degrees.

Rather than have you feel the pain of trying to make sense of Android Sensor data from scratch we’ve made a quick printable cheat sheet, so puzzle no more!

SensorEventListener cheatsheet

Android SDK at time of writing was: android-sdk-mac_x86-1.5

Citations & Research

7 Comments

Building Android: CupCake

Latest emulator with on-screen keyboard

‘Cupcake’ is the name of the new Android OS which will shortly hit the consumer market.  Future Android based phones – such as Lenovo or Kogan agora – will by default probably have the CupCake milestone of the OS installed. This new version carries with it, bug fixes and a couple of enhancements such as video recorder and on-screen keyboard.

There are times when your application’s future compatibility testing cannot wait for an official milestone release and you require the very latest  development image of the Android OS to run under the latest Android emulator. There are of course other Android enthusiasts like myself who will find it very exciting to download and play with the source and I’d recommend it, as it is not difficult.  In this article I will detail my experience of following the official android documentation to obtain the latest source from the main Android development branch, in this case the contents of CupCake; compiling it and then finally running the images under the latest emulator.
Development Environment

Manually building the source code is system intensive so you should have a good machine in order to compile the project, enough disk space (around 6GB) and a good connection as you will download around 2GB. Currently, I am running Ubuntu intrepid 8.10 with kernel 2.6.27-11-generic and Sun’s jvm 1.6 on a quad core with 4GB of RAM.
Thus the below assumes you are running similar setup. The official Android installation page lists the procedure for Max OS and Windows.

1. Obtaining the code

I followed the Google documentation wiki page without any problems. I had a previous version of the source code checked out on to my machine which I had to update, thus I had to remove the recovery directory as discussed here and here with the following command: rm -rf recovery bootloader

If you do a fresh init you will not need to remove the 2 directories. As I am on amd64, I also had to install the X11 dev packages and followed the workaround suggested for X11.

Note that I did not need to update the java alternative to ia32-sun-java6-bin and used the sun-java6-jdk instead. Furthermore, I did not need to point ANDROID_JAVA_HOME to my JAVA_HOME variable.

2. Compilation

WIth the source code checked out I now made a compilation with ‘make’. The compilation took some time – around an hour on my quad core – enough time to drink a couple of espressos and poke around the source structure. A successful compilation produced a new directory at the root of the source called ‘out’. This directory contained the newly created build which can then be used to start the emulator.

3. Layering on proprietary libs from the G1 – optional

Specific phone manufacturers commonly bundle their own libraries for specific phones. Usually those libraries are proprietary thus need to be downloaded from the phone itself. For now, this is possible only for the G1 as this wiki page indicates. Note that I used my T-mobile phone, not the dev one.

Running ‘make’ will create a specific build for the phone located under ‘<android_source>/out/target/product/dream’. You can run that build within the emulator which would be specific to the HTC dream. I would not anticipate much difference except that you would not have access to specific proprietary hardware powered devices such as the camera phone.

4. Starting the emulator with the new build

Now with a fresh build, I could start the emulator with the new images.
Issued from the root of source, the following command started the emulator with the dream’s image:

./out/host/linux-x86/bin/emulator
 -system out/target/product/dream
-kernel prebuilt/android-arm/kernel/kernel-qemu
-data out/target/product/dream/userdata.img

If you have followed me this far but did not compile the dream target, you can run the default images as follow:

./out/host/linux-x86/bin/emulator
-system out/target/product/default
-kernel prebuilt/android-arm/kernel/kernel-qemu
-data out/target/product/default/userdata.img

Voila! I had the latest emulator running! I accessed it using ‘adb shell’ and installed my test applications using: adb install <app>.apk
Stumbling a little is to be expected with any new undertaking but I found the solution to the majority of your average source compilation problems can be found within the or on the well tended official source code documention. Otherwise Google Groups hosts’ an active android mailing list who will try their best to answer questions.

Next I will look into setting up eclipse and maybe playing around with the code if my caffeine level stays high enough.

Citations & Research

2 Comments

Fom2008 and coming articles

On Tuesday 18th November Novoda attended London’s Future of Mobile 2008 and gave a short workshop introduction to Android in conjunction with Kieran Gutteridge of Intohand. The talk was aimed at developers experienced in a variety of other mobile and embedded platforms but who were not familiar with the various specifics of Android. All the attendant’s benefited from the presentation, but ideally more resources prepared for the event would have increased it’s value for everyone. In light of the questions asked to us by developers at FOM we will present on this blog, a series of articles based around the lesser explained points of Android’s underlying architecture and design.

Carl Carl presenting at Fom 2008 with Kieran Gutteridge

Carl presenting at Fom 2008 with Kieran Gutteridge

A Summary of coming articles

In this series we will seek to offer value over Google’s own very well prepared documentation by layering external developer experience and context to each of the areas we cover. This series is intended for seasoned developers who wish to gain a well documented, experienced technical insight into the platform. The following articles are planned:

Android Architecture Overview

Android is often cited as a ‘full stack’. This means that the platform is provided with an OS, sys bins/libs, JRE and SDK. The full shabang is open source from top to bottom but the documentation only lightly covers the Dalvik Virtual Machine. We explore the specifically built packages that make up android from the kernel to the Java libraries in the hope to completely orientate developers with the inner technical workings within most current Android package.

AndroidManifest.xml

The AndroidManifest.xml serves as an application’s contract between it’s end environment and the other installed applications. Through the AndroidManifest.xml an application can choose to expose its intentions, services and content to outside applications. We look into the alternative situations in which the AndroidManifest.xml’s role affects an application and expose its implementation.

Activities

An activity is embodied as a screen and breaks up high level functional elements in an Application. When navigating through an android system the forefront process operates upon the ‘context’ of the shown Activity. We examine the relationships between different types of activities in an attempt to completely understand their life cycle and how it affects the surrounding system.

Intents & BroadcasteReceivers

In Android, actions and re-actions across processes and activities are carried out through means of Intents and BroadcastReceivers. Instead of hard coding the intended application path, applications can choose to leave their journey open to re navigation and simply declare their intentions to the rest of the system. By preemptively declaring their intentions, both the user and other applications can choose to supplement any behavior upon their phone with any other piece of software that offers the same functionality. We explore the extents to which you can choose to customize the experience and look at the practical aspects and challenges that lie in deciding how to best share with the rest of the system.

Views and Resources

External resources are subject to localization and more commonly changed than the internals of an applications inner code. For this reason amongst others the layouts of views are marked up in xml. Binary resources such as images and audio files are also more prone to change and security issues and so are located within a predefined area. The Android SDK makes all resources available through an automatically generated and local binary registry. An application can easily access any of it’s resources via this registry throughout it’s operation. To what advantage has xml been used in such an unconventional why does the Android SDK choose to enforce the location of all binary files so rigidly?

Services

Services have no user interface and can run locally within an application or can take on a life of their own outside any one application, adhering to Linux’s inbuilt security model. Remote Services are shared via Android’s own IDL (Interface description language). The majority of the code for this external communication is generated for a user after declaring the interface by which the data is to be exchanged.

Content Providers

The architecture of Android applications is designed around the idea of opting into a degree of sharing within a community of applications. And application can choose to what extent it makes its data available through content providers. Content providers promote the idea of global data inter exchange and reuse within every system and we look at how Applications can best take advantage of this unique feature upon the Android platform.

We would be very happy to hear comments, criticism and requests so if you have anything to say on anything we cover then please leave a comment.

Citations & Research

0 Comments

Extending Android’s shell with BusyBox

A vanilla android installation is a bare bones affair aimed solely at the mobile device. This comes at the initial expense of our development environment. This platform is only intended for only the smallest devices and so searching amongst ‘system/bin‘ reveals only a cherry picking of Linux system administrator staples, even the most common binaries such as ‘ls‘, ‘mv‘ and ‘rm‘ have been stripped of all but their essential options and recompiled. Installing third party tools on Android offers a range of additional productive tools and options for ease of development within the Android shell.

Android shell

Invoking the android emulator from within an IDE is the ideal setup but developers will find need to interact with the emulator through other means for scripting, integration testing and just practical reasons. The SDK tools are located in the tools directory and I’d recommend regular users of the sdk to add this directory to their shell’s export path.

I develop on a mac so I have added the android-sdk-mac_x86-1.0_r1/tools to my .profile but you could equally add it to your .bashrc or .kornrc within your user’s home area giving you convenient direct access to all of android’s development tools via the binary names such as $adb, $emulator or $ddms. If you are on a windows machine these variables would instead be set via your system settings -> environment variables.

With the tools on the shells $PATH, the emulator can now be invoked:

$emulator

Now to telnet to the running device image:

$adb shell

BusyBox

BusyBox is a single multicall binary that packages the functionality of many popular standard Unix tools. The aim of the BusyBox project is to keep the total package size overhead as small as possible by sharing commonly used gnu libC libraries via a single set of ELF headers and stripping down gnu’s libc so as only to provide the functions necessary to support Busybox and the other executables.

Side note – Standing up for GNU with legal action

Busybox author’s have gained a reputation for their commendable efforts to uphold the legal rights of the GNU public license as they have brought about court action as plaintiffs on a series of cases where they believed companies were not holding to the terms of GNU public license. Companies they have appealed against include Verizon, High-Gain Antennas and Xterasys. Most notably they are commonly credited with the first GNU public licence related court action against Monsoon Multimedia for their use of BusyBox within it’s HAVA streaming video software (Hava have since made their alterations available). So far all cases have been settled before they reached the court.

Installing busy box on Android

It is common place for developers to check out the source of BusyBox and compile a tailor made build with any preferred tools and options. There are others like myself who just use whatever they can find and I have settled with a build generously donated with the intent of android deployment by Ben Leslie available from both his site and the run buddy code wiki.

First aquire your build and then add it to the running android device like so:

$adb shell mkdir /data/busybox
$adb push busybox /data/busybox
$adb shell

Now within the android Emulator shell:

$cd /data/busybox
$chmod 775 busybox
$./busybox –install

Now you have installed BusyBox!

For ease of use I would add this to the shell’s $PATH

export PATH=/data/busybox:$PATH

Now invoking busybox will reveal all your new commands!

$busybox

Some highlights of this particular binary of BusyBox are:
chown, chgrp: change permission ownership.
awk, sed: languages to both process & transform text
grep: a text search utility
du: shows disk usage
vi: a shell based text editor
pidof: return the pid of a running process
less: text reader with back and forward nav
tail: trail the end of a file for activity
gunzip, gzip, tar, bzip2: archival compression software
clear: clear screen
crontab, crond: task scheduling
diff: compare files
httpd: a light webserver
telnet: basic TCP remote login
xargs: use the output of a command as the arguments for another
su: masquerade as another system user
wget: retrieves content from a web server
which: identifies the location of an executable
For info on these or any linux commands check the man pages online.

Have I missed any of your shell essentials? If you have any BusyBox builds for Android then we’d love to hear about how you are using them in your development environment.

Android SDK at time of writing was: android-sdk-mac_x86-1.0_r1

Citations & Research

4 Comments