Tuesday, March 31, 2009

Android Eye Contact

I'm working on Android Eye Contact, and application that complements the standard Android Contacts application and provides alternative presentations.
The application, in its Lite version, can be freely downloaded from Android Market.
There will be also a Pro version, someday when people from other countries other than USA and UK be able to charge from their applications. In the meantime there's a very good opportunity to explore the possibilities analyzing what should be included and what shouldn't.
The main idea behind Android Eye Contact is to provide a seamless user experience easing access to contacts ideally using only one hand and with the phone closed, if we think about the available models only.
Some users requested features like Contacts Flow, and I'm now experimenting on this front, though I'm not completely convinced that this is a good way to glimpse through hundreds of contacts which usually don't have a picture associated.
Anyway, this is highly based on great pictureflow, a Qt2/Qt3/Qt4/Qtopia4 widget to display images with animated transition effect.

Comments, suggestions and ideas you may want to share are gladly welcome.


Friday, March 13, 2009

android web applications seamlessly integrate native widgets

I'm writing some android sample code to be included in training courses and I found this example so interesting that I decided to publish it here to share it with you. I hope you find it interesting too.

This example is extremely simple, just a few lines of code, but demonstrates how powerful the idea of mixing native widgets and web applications can be.

The application consists of an oversimplified web browser based on WebView and a super imposed SeekBar slider that when is moved changes the background color of the page using javascript. The default page is http://google.com to demonstrate that no special javascript code is needed in the page.


video

Views hierarchy
This is how we defined the layout.



Basically, the idea is to have a RelativeLayout holding the WebView and the SeekBar over it.

Changing the background color

This is the most interesting part, in the SeekBar change listener we will be invoking the javascript needed to change the page background color using the DOM. Also we will be using a simple conversion from the progress value to HSV colors.
To invoke the javascript we use webView.loadUrl.







// change color depending on seek bar position
colorBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromTouch) {
float p100 = progress / 100.0f;
webView.loadUrl(String.format(
"javascript:{document.body.style.backgroundColor='#%06x'}",
Color.HSVToColor(new float[] {360 * p100, p100, 1 - p100 }) &
OPAQUE));

}

@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

});



Seamless applications
One of the main objectives of the android platform is to provide a seamless experience to the user. In this case we have seen how to seamlessly integrate native and web applications.

Installing the application
To install Android Web Page Background Color Bridge into your phone or emulator visit http://codtech.com/downloads/android directly from the device providing you have an SD card to download it and the required permission enable to install application from Unknown Sources in Settings.

Source code
Source code can also be downloaded from http://codtech.com/downloads/android

Monday, March 09, 2009

Android Meenie early preview: more features described

In my previous post we've seen some basic features of Meenie, like adding placemarks to the map while you are on the road, but there's a more common use case when you are planning your trip in advance and want to add some placemarks, let's say the airport, hotel, office, restaurants, etc.

While it's perfectly possible to use the same use case as being on the road, it's much more confortable to add those placemarks and search for restaurants, hotels or whatever you are looking for in the comfort of your desktop computer. In those cases we will be using Google Maps to help us.
Google Maps has a feature called My Maps, where you can define map placemarks, lines and areas.


Then using a conversion utility which is running in Google Appengine to off-load the processing of the map in the android phone, we will be able to download this map and allow Meenie to show the same content. To locate the map we will be using the URL that appears in Link, in Google Maps top right.

This is the result.

video

Some details about Google Appengine being access from Android and using the Google Maps Link URL in Meenie and other Android applications were ommited for clarity and will be discussed on upcoming posts.



As always, comments are gladly welcome.

Wednesday, March 04, 2009

Android Meenie early preview

I was working on an Android application that scratchs a personal itch. As I'm traveling very frequently and visiting new cities all the time I always need some information readily available.
For example, the airport, station, hotel, office, venue, places to visit, restaurants, etc.
You need these information quickly accessible, while you travel.

This is an early preview of Android Meenie maps front end. I'm working on the server side now, so more information is coming soon.

video

Monday, March 02, 2009

Android emulator small bug

I wonder why Android SDK for Linux is distributed as a ZIP file, but anyway if you try to install the SDK in a multiuser environment you'll face some problems.
As usual, in a multiuser environment to avoid undesired changes to the software it should be installed as root.
Unpacking the SDK as root and then running as a normal user you receive this error

### WARNING: Cannot write user data file '/home/diego/.android/SDK-1.1/userdata-qemu.img'

if you check file permissions you can find that you can write to ~/.andrid/SDK-1.1 and userdata-qemu.img has been actually written.

So, what's the problem. Using strace to find out, we can see this

open("/home/diego/.android/SDK-1.1/userdata-qemu.img", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0600) = 3
open("/opt/android-sdk-linux_x86-1.1_r1/tools/lib/images//userdata.img", O_RDONLY|O_NOCTTY|O_LARGEFILE) = -1 EACCES (Permission denied)
close(3) = 0
write(2, "### WARNING: Cannot write user d"..., 109### WARNING: Cannot write user data file '/home/diego/.android/SDK-1.1/userdata-qemu.img': Permission denied ) = 109 unlink("/home/diego/.android/SDK-1.1/userdata-qemu.img.lock") = 0
exit_group(3) = ?

qemu is reporting the wrong error, and the root of the problem is openning /opt/android-sdk-linux_x86-1.1_r1/tools/lib/images//userdata.img for reading.


Here is how to fix it

$ sudo chmod a+r /opt/android-sdk-linux_x86-1.1_r1/tools/lib/images//userdata.img
$ sudo chmod a+r /opt/android-sdk-linux_x86-1.1_r1/tools/lib/images//system.img

and everything will run smoothly.