Archive for the ‘Android’ Category

Android Is the Most Closed Mobile Open Source Project – and Is One of the Most Successful

Sunday, July 31st, 2011

I happened to see a link to a study made by visionmobile (http://www.visionmobile.com), a market analysis and research company, made in July 2011 comparing different open source projects amongst a variety of predefined factors that constitute on how “open” a project is.

This is by far one of the most balanced studies I’ve seen comparing successful (and unsuccessful) well-known open source projects. Incidentally, visionmobile’s clients include HTC, Sony Ericsson, RIM, Microsoft, Intel, etc as part of it’s well known client lists.

Their quantification of “openness” between selected mobile open source projects (both successful and unsuccesful, single sponsor and multi sponsor) is called as the “Open Governance Index”.

The results were particularly interesting:

Among the 8 open source projects listed, Eclipse was the most “open” of all the projects, and Android was the last in the list. The research paper however noted that Android is also one of the most successful projects in the history of open source. It was contradictory enough that the paper called it the “Android Paradox”.

A number of interlinking factors were cited what made Android successful:
1. Google’s financial muscle and marketing.
2. Android’s “zero cost” subsidy by Google, since Google’s ultimate purpose is to drive more eyeballs to it’s ad inventory, which results to cheap handsets and low cost internet connectivity.
3. The adoption of the Open Source project by different manufacturers in order to compete against Apple’s iphone. The OEM industry generally poured billions of dollars into Android in order to compete with the Cupertino company’s product.

In retrospect, the research paper acknowledged that in the long term, platforms with the most open governance will be the most successful. Cited success stories are Eclipse, Linux, WebKit and Mozilla. Meego has the capability to become a successful project in the long term, in my opinion.

It also went to suggest that making a project open doesn’t necessary warrant a successful community builder. They stated that Software developers are human in nature and self-centered; and will only take interest in such a project if it provides value or addresses a common need – citing Linux, GTK or Webkit as an example (need for a vendor-neutral operating system, graphics software stack, browser engine). Symbian failed in this aspect; they failed to target developers (besides this, no proper development tools, complex contributions structure, etc).

What does this mean for Android and competing open source projects such as Meego?

Android was successful because aside from the factors stated above, when Android was released to the developers, the product was already a very advanced, and complete project (by and large due to Google’s famed engineering team):

However, there are some very good lessons for us to learn from how Google has managed the Android
open source project. First, Android was released as an open source project at a point in time where it
was already a very advanced, complete project. OEMs, operators and software developers could more
or less immediately use it to create derivative handsets and applications. Second, Google kickstarted a
developer buzz around the project with the $10 million Android Developers Challenge. Alongside
financial incentives, Google provided a very strong emotional message: that of opening application
development within a previously inaccessible mobile industry. Finally, Google’s speed of innovation
(five platform versions across 2010) outpaces any external innovation, and makes the ecosystem
entirely reliant on Google.

On the other hand, when Meego was announced, it was basically starting from scratch (okay, not exactly scratch, but the earliest versions of Meego were in the command line ;) from my perspective) – try to imagine that they essentially went from a deb-based packaging solution (Maemo) to an rpm based one, and shifted from GTK/clutter to mainly Qt. This was one of the disadvantages I saw with the early development of Meego, and I have to say most likely hampered it’s early adoption (I do like the very open way the meetings are held though – I’ve been in one of the developer meetings in the past; but due to time zones it’s really difficult for me to attend it). It has gotten way better though; with the inclusion of non-Nokia/Intel people into the upper build team, the development process is getting to a point where I believe that this operating system will likely pick up pace and steam in the very near future (it has a bright future ahead in IVI systems in vehicles for example, and the upcoming N9 is positively received by many).

Putting It All Together: SpellDial php class and Android Application – Part Two

Sunday, July 10th, 2011

I’m back, and I’ve got a little time on my hands. Let’s continue on how to use the spelldial php class now in an android phonegap application.

Now, let’s look at the actual php code that will make the spelldial call based on what your android spelldial app will send:

You can save this code snippet in a file named droidspell.php:

include "spelldial.php";
$spell = new Spelldial();
$result = $spell->get_info($_POST['spelldial'],$_POST['calltype']);
if($result->error_code !== '0')
{
die("error");
}
echo $result->content[0]->info[0]->uri;

This is a typical use of the spelldial class I made (this uses post variables spelldial and calltype, ie. tel or skype to determine what to return as output to the android application).

Now for the html code snippet:

<script src="jquery-1.4.2.min.js">jquery-1.4.2.min.js</script>
<form id="spellform" name="spellform" method="post" action="http://yoursite/droidspell.php">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="27" colspan="2">SpellDial Name</td>
</tr>
<tr>
<td height="31" colspan="2"><label>
<input type="text" name="spelldial" id="spelldial" />
</label></td>
</tr>
<tr>
<td height="42" colspan="2" valign="top"><label>
<select name="calltype" id="calltype">
<option value="TEL">Telephone</option>
<option value="SKYPE">Skype</option>
</select>
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<input type="submit" name="dial" id="dial" value="Call me using SpellDial" />
</label></td>
</tr>
</table>
</form>
<script>
$("#spellform").submit(function(event) {
event.preventDefault();
var $form = $( this ), spelldial = $form.find( 'input[name="spelldial"]' ).val(), calltype = $form.find( 'select[name="calltype"]' ).val(),
url = $form.attr( 'action' );
$.post( url, { 'spelldial': spelldial, 'calltype': calltype },
function( data ) {
if(data == 'error' || data == '')
{
alert('Spelldial API returned an error: '+data);
} else {
location.href = data;
}
}
);
});
</script>

As you may see, this is typical html form/jquery event code to get the result of the droidspell.php call and then determine if an error occurred and if not, go ahead to the android dialer to make a call.

You’ll see some stuff like jquery-1.4.2.min.js in the code above. Where is it placed? It is placed where the index.html is placed in the assets/www folder:

If you want to use the phonegap wrapper functions place this snippet in the <head> portion of your index.html file:

<script type="text/javascript" charset="utf-8" src="phonegap.0.9.6.js"></script>

You may rename phonegap.0.9.6.js to phonegap.js if you wish.

This is how a finished phonegap application looks like in the emulator (yeah yeah, ugliness noted, I made this quickly!):

Once you see this application running in your emulator, you might want to package this application into an apk. Simply right click on your project in the project window and select Android Tools->Export Unsigned Application Package – once you follow the instructions, this will create an unsigned apk file for you automatically.

You can also create signed apk files for distribution into the Market. For further reference, please see http://developer.android.com/guide/publishing/app-signing.html for details.

And there you have it, we have now made an android application in phonegap using the spelldial php class, tested it in an emulator, and published it as an apk file.

Putting It All Together: SpellDial php class and Android Application – Part One

Thursday, June 23rd, 2011

Ok, I’ve got a little time on my hand before I start with a wordpress project I am doing (creating wordpress plugins are fun :) – yipee ).

Let’s try to make a simple Android application using the phonegap cross-development framework calling a php script that uses my spelldial class to return a spelldial uri. Part one will describe steps on how to make your very first native webapplication in android (simply a hello world android web application).

I assume that you know how to install eclipse, the android sdk and the phonegap framework on your system (I’ll cover this in small detail, to help you get started).

There are many ways to program in android, ios, symbian, blackberry or winmo phones. There are cross-development frameworks which give you an abstract way to program in these mobile devices without dealing with the underlying phone hardware.

Two different technologies come to mind (these are the most popular that I’ve seen):
1. Appcelerator Titanium – this cross development tool allows web developers to quickly go into the mobile application department using what they know. HTML5, CSS, and a host of web programming languages such as php and ruby are supported. What is unique about this SDK is that these technologies are then compiled into their native counterparts – the end result is a native application. Impressive, actually. Supports both iOS and Android environments.
2. Phonegap takes a different approach. This is closest to what you call as a web application encapsulated in the mobile phone’s browser class. For example, what this means, in Android, this framework wraps around the WebView Java class and makes certain native phone functionalities available (like accessing your contacts for example) through javascript. For flash/flex developers, this is much like the ExternalInterface class that bridges between javascript and the flash application.

Which is more appropriate? If you’re a web developer and would like to make your application as close as possible to a native application, your best bet would be Appcelerator.

Why am I using phonegap in this case? If you just like to quickly develop applications and do not care if they look different from native applications, use phonegap. By the way, because of how phonegap works, it is available to more mobile environments than Appcelerator. Symbian, WinMo, Blackberry, iOS and Android mobile environments are supported by phonegap. No matter what the environment, your application would look the same because it is just practically your html application enclosed in the native phone’s browser class.

Also, phonegap is supported by the Dreamweaver CS 5.5 release, which means if you can afford it, mobile development will be quite simple to do (without using Eclipse as your environment to develop phonegap applications).

Now, lets begin. Let’s create a new project in eclipse by selecting File->New->Other

We now include our details for the application (Since Froyo or Eclair, the android version before 2.2, runs in 86% of android phones, I choose the lowest common denominator, Eclair), below:

We will have to add the phonegap jar file to the libs folder (which you will have to create) and also create the /assets/www folder where you will place the html files for your application. In this www folder, you will have also to place the phonegap.js file in there. This js file contains the functions that you will call to access native mobile phone functions such as accessing your camera, contacts, etc.

In order for Eclipse not to spurt out an error message (having a java class not available for use), we have to add phonegap.jar to the Build Path (Right click on the libs folder, select Build Path->Configure Build Path):

We will now edit the spelldial.java source code which was created using the New Project Wizard to look like this:

Let’s look at it line by line:

import ...
import com.phonegap.*;

The code above imports the phonegap class for use in our application.

public class spelldial extends DroidGap

Our spelldial class (which was created by the Wizard), extends upon the DroidGap class, which is in fact an extension of the WebView class.

This line below is what runs the web application (sort of like the main() function in your c program):

super.loadUrl("file://android_asset/www/index.html");

You can change the url to whatever you have placed in the assets/www folder as your starting point. index.html can simply be text saying “hello world” at this point.

One more thing, since phonegap uses certain native phone functions which require explicit permissions for the app to run, we’ll have to edit our AndroidManifest.xml to allow our app to use these:

These tags are placed below the android:versionName section:

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

And there you have it, some basic steps on how to set up the phonegap framework in eclipse. Part 2 will be the actual js code and php code that this web application uses to call a person using the spelldial api php class hosted on a server.

To end this, let’s take a look at phonegap support in Dreamweaver CS 5.5:

How to Set Up OpenVPN on Android

Wednesday, April 27th, 2011

I am simply placing these instructions which I made for some people asking how to use my tun.ko module (Based on Phantom King Skyfish) in a popular phone forum.  You can generally use these instructions to correctly install openvpn on android devices.

  1. Download OpenVPN Installer and OpenVPN Settings from the Market.  If you don’t have tun.ko yet download the module I compiled for kernel 2.6.32.9 ARMv6 devices from here.
  2. Run OpenVPN Installer (openvpn should be installed in /system/xbin, and ifconfig path in /system/xbin/bb).  /system/xbin/bb is not available yet, we’ll get to it later.  For roms like Bakpia Keju which do not have route and ifconfig busybox links properly installed, do the following in the terminal:

    adb shell
    bash
    cd /system/bin
    ln -s /system/xbin/busybox cp
    ln -s /system/xbin/busybox chmod
    ln -s /system/xbin/busybox route

  3. Use a barcode scanner (available in the market) to read the barcode below:
  4. Paste this code in SL4A application (also available in Skyfish).  If you’re not in Skyfish, make a script named openvpn.sh and paste the text from the barcode in there.  Save and run the script.  This should make the proper route, ifconfig and busybox binaries be symlinked to make the OpenVPN Settings run properly.  If you like to use SL4A, you can download the application from here.

Your openvpn is now configured properly and should now work as expected.

The… Android Dance?!!!

Sunday, March 27th, 2011

Just a short post…

I just happened to watch a youtube video of the Android mascot dancing to a spiffy beat. I don’t know about you, but I found this awesome!

Enjoy the vid below:

2.6.32.9 tun.ko armv6 module for Z71 variants (froyo)

Wednesday, March 23rd, 2011

Short post.

This is tested in the Bakpia mod kernel (2.6.32.9), module compiled from the rmcc github kernel 2.6.32.9 branch located here.

Compiled in a CentOS 5.3 environment with android ndk and sdk installed.

Anyways, copy the module to /system/lib/modules do an insmod tun.ko to run the module and tunneling is all set. You can now use Openvpn downloaded from the Market.

Download here.

How to compile tun.ko For Android (Commtiva Z71)

Monday, March 21st, 2011

I’ve been too busy these days to compile a kernel module for android.

For those who want to compile a tun.ko kernel for Android (a commtiva z71 variant), here are the general steps. You need a linux environment to compile this module.

1. Download the kernel and supporting files for commtiva z71 devices here: https://opensource.motorola.com/sf/frs/do/viewRelease/projects.quenchxt/frs.xt5.xt502 and extract it to a directory of your choice.
2. Download the SDK and NDK for android: http://developer.android.com/sdk/ndk/index.html and http://developer.android.com/sdk/index.html
3. Copy config.gz from your phone and place it into your kernel source folder. To get it from your phone, type:
adb pull /proc/config.gz .
gunzip config.gz
mv config .config
4. Edit .config so as TUN module will be included into the kernel:
CONFIG_TUN=m
5. Run uname to get running kernel version of your phone:
uname -a
Linux localhost 2.6.32.9 #7 PREEMPT Tue Jan 4 16:51:45 CST 2011 arv61 GNU/Linux
6. If there was some extra characters in your kernel version, like 2.6.32.9-063c4d24, you’d have to edit the Makefile to use the corresponding version:
EXTRAVERSION = -063c4d24
7. Set your environment variables:
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:~[path of your arm-eabi compile toolkit binary in android ndk]
8. cd to your kernel folder and make modules
cd ~[path of your kernel source]
make modules

Resulting tun.ko should be in the drivers/net folder of your kernel source.

Just beware, it is not for the fainthearted.

Further information:
http://android-dls.com/wiki/index.php?title=Build_a_custom_kernel
http://forum.androidcentral.com/htc-hero-rooting-roms-hacks/8072-how-build-your-own-kernel-package-source.html

Froyo Mod on Commtiva Z71 Variant (Cherry Mobile Nova)

Monday, March 14th, 2011

Just a quickie video post. Since this reseller keeps quiet on whether they will update their commtiva z71 variant, I decided to upgrade my phone myself. Got much faster speed, and I’m very satisfied with the result! Been working with phonegap too – so android development, here I come!

Facebook Zero on Android

Wednesday, January 19th, 2011

I’ve been asked by some people on how to access facebook for free on their android mobile phone in the Philippines. Well, you can do this if you have a Sun cellular sim card, using a service called facebook zero.

I did this on my Cherry Mobile Nova, but basically all android phones have similar settings screen.

Facebook Zero is a service by Sun Cellular offered to its subscribers to access the popular social networking site for free (by now). Let us see how to configure this currently free service for android devices.

We need to make sure that the Sun wap APN is configured on the Settings->Wireless & Networks->Mobile network Settings->Access Point Names as shown below:

If its not created yet, let us create a new APN called “Sun GPRS” (screenshot below shows the important settings used for this wap service):

Select this APN for use and on the previous screen, enable Data:

This will let android connect to the wap service. Let us now open the default android browser and type in “0.facebook.com”:

If successful, you will now connect through the browser (through wap) to facebook for FREE. Happy surfing!