Sunday, November 7, 2010

Google - App Inventor for Android

Hi Readers,

Last Saturday 30th OCT 2010, I got the opportunity to attend the meet up for Google's App Inventor by the Code Android Malaysia Group. The meetup is great, learned new stuff & explore few Android devices (WITS A81E, Haipad G10, Zenithink ZT-180 ePad, Dell Streak, Samsung Galaxy S, HTC Dream/G1, & Nexus One).

App InventorApp Inventor is a web based tool from Google that makes it easy for anyone (programmer & non-programmer) to create mobile applications for Android-powered devices. It provides us visual blocks which help us to create mobile applications by drag-and-drop functionality. Some of the few features of App-Inventor are listed as below:-
  1. No syntax : No need to remember the coding syntax of programming languages.
  2. Visual Blocks : The components and functions are organized into blocks. Need to find relevant block & used that function by drag-&-drop feature.
  3. Functionality based on Events : "When this event happens, the application does this" is the correct conceptual model. Support this feature with event listeners!
  4. Support & Simplicity : App Inventor supports a great library of visual components with simplicity of use by end user to develop mobile applications.
To use App Inventor, you do not need to be a developer. This is because instead of writing code, you visually design the way the app looks and use blocks to specify the app's behavior. App Inventor is simple to use, but also very powerful. It provide the functionality to store data, use GPS-Location & Accelerometer Sensor and many more features. To storing data in application it use TinyDB & stored data will be available each time the app runs. TinyDB is a non-visible component. The blocks editor uses the Open Blocks Java library for creating visual blocks programming languages.

Android App Inventor


Few facts about App Inventor:-
  • For multiple screen application App Inventor have each .apk file; you need to invoke relevant file on the calling event of multiple screen application.
  • App Inventor is not integrated with Android Market yet.
  • App Inventor does not generate the Java source code to export to Eclipse or any other IDE.
  • You can integrate the App Inventor with your real device and also with Android SDK.
Android App Inventor Tutorial:-
You can find basic & advanced tutorial for App Inventor over here.

Sunday, October 3, 2010

How to get IMEI on Android Devices?

Hi Readers,

As per your queries about IMEI on Android devices; I am posting this article, please do let me know with your feedback and further queries. The solution is as follows:-

Device, network, SIM & data state related info on Android platform is managed by TelephonyManager. Your application can use the methods defined in this class to determine the desired information. Please note, you cannot instantiate this class directly; instead you need to retrieve a reference to an instance like this:-

String serviceName = Context.TELEPHONY_SERVICE;
TelephonyManager m_telephonyManager = (TelephonyManager) getSystemService(serviceName);

To access some telephony information you need to set appropriate permission in your application manifest file, because few informations are permission protected. In our case we need to set permission for our app:-

Now let's start with actual source code to retrieve the information:-

public String findDeviceID() {
     String deviceID = null;
     String serviceName = Context.TELEPHONY_SERVICE;
     TelephonyManager m_telephonyManager = (TelephonyManager) getSystemService(serviceName);
     int deviceType = m_telephonyManager.getPhoneType();
     switch (deviceType) {
           case (TelephonyManager.PHONE_TYPE_GSM):
           break;
  case (TelephonyManager.PHONE_TYPE_CDMA):
  break;
  case (TelephonyManager.PHONE_TYPE_NONE):
  break;
          default:
         break;
     }
     deviceID = m_telephonyManager.getDeviceId();
     return deviceID;
}

The above method will return you the IMEI in-case of GSM and MEID or ESN for CDMA devices. When you can run this code on real device the output will be like this:-
Point to be noted here is deviceType that we are getting using TelephonyManager Class. This code will work on Android 1.6 and above because CDMA stack is implemented on Android 1.6 and above. So If you are using Android 1.5 devices just remove CDMA related code from it.

Using TelephonyManager you can retrieve much more information about device. For example:-

Retreive MSISDN:-
String msisdn =  m_telephonyManager.getLine1Number();
Retreive SIM Serial Number:-
String simSerialNumber = m_telephonyManager.getSimSerialNumber();
Retreive IMSI:-
String imsi = m_telephonyManager.getSubscriberId();

For more info please visit TelephonyManager

Thursday, September 9, 2010

Mobile Application Testing

Types of Mobile Application
  1. WAP Application – These applications are browser based applications & end user can access these applications using WAP/Mobile browser. These applications cannot work in offline mode (Without GPRS connectivity). For example:-
    • m.google.com
    • m.youtube.com
    • cnnmobile.com
  2. Installable Applications – These applications are installable applications and end user can install these applications on their handset and these applications have ability to work in offline mode (Without GPRS connectivity). For Example:-
    • Twitter App
    • Yahoo Go!
    • Messenger Apps
Testing of Mobile Applications:-
We can test mobile applications by using SDKs, Testing Tools and on the real devices. To test Mobile Applications we have various tools available and listed as below:
  1. http://ready.mobi/launch.jsp?locale=en_EN - is tests mobile-readiness using industry best practices & standards. After testing you receive a free report outlining how well your site performs.
  2. http://jigsaw.w3.org/css-validator/ - CSS Validation Tool
  3. dotMobi Emulator – A tool which emulates a real mobile phone Web browser. It’s a bit limited as you can only choose from two different phones you like as a skin.
  4. http://validator.w3.org/mobile/ - Performs various test on a web page for mobile-friendliness.
  5. Firefox For Mobile Testing - Firefox is powered with few add-on using which we can test mobile Web site. To make Firefox imitate a mobile device you need:
    1. The Firefox Web browser
    2. The Modify Headers add-on
    3. The User Agent Switcher add-on
    4. A UA Profile HTTP Header
  6. http://www.testiphone.com/ - This is a web browser based simulator for quickly testing your iPhone web applications. This tool has been so far tested and working using Internet Explorer 7, FireFox 2 and Safari 3.
  7. http://www.genuitec.com/mobile/ - MobiOne iPhone/PalmPre SDK Emulator for Windows. Provide various functionality test on Mobile WAP sites like memory management etc.
  8. Vendor Specific Emulators/SDKs – We can also find vendor specific SDKs and Emulators for mobile application testing. We can download these SDKs from below mention links:-
    1. Android Emulator
    2. iPhone Simulator
    3. BlackBerry simulators
    4. Nokia Emulators
    5. Samsung Emulators
    6. Motorola Emulators
    7. SonyEricsson Emulators
    8. LG Emulators
    9. Windows Mobile Emulators
    10. Palm Emulator
    11. i-mode HTML Simulator
    12. Opera Mobile Emulator
  9. DeviceAnywhere - DeviceAnywhere is a great platform for mobile application testing. It provides us a feature using which we can test mobile application on real device from remote location on any remote network/operator. DeviceAnywhere is trusted and widely accepted testing tool for mobile application. It also provide us automation testing tool for mobile applications. The APIs are build using Java and end user can use for different vendor devices. They have some predefined automation testing scripts and end user can also build their own automation test scripts. During test you can also used device basic feature make a call, receive a call, SMS etc. Nokia, Samsung, SonyEricsson also provide RDA (Remote Device Access) facility in collaboration with DeviceAnywhere. Using DeviceAnywhere we can test our apps on the upcoming handsets in advance, because most of the vendors open access to their upcoming handset using DeviceAnywhere.
  10. Perfectomobile - It’s a similar platform like DeviceAnywhere, but new to market. It also provides same feature as DeviceAnywhere. For more info please visit – Knowledge Center
  11. UISpec - UISpec is a Behavior Driven Development framework for the iPhone that provides a full automated testing solution that drives the actual iPhone UI. It provides us a library that we can use on the MAC OS – Xcode. It’s a opensource project by Google and mostly used to test the UI behavior of an iPhone App.
  12. FoneMonkey – FoneMonkey is a functional testing tool for the iPhone providing for the interactive creation, editing and playback of automation scripts that exercise an application's user interface. Using FoneMonkey, you can create suites of tests that automate performing user operation sequences and verifying results. FoneMonkey is designed to support developer as well as QA testing, and FoneMonkey tests can be easily incorporated into continuous integration environments. 

Saturday, July 17, 2010

Block a Call

Hi Readers,

Again while working on my blog, I found that some one of you are looking for an article on "Block a Call". But I am not clear about the stuff that you are looking for using J2ME or for some other technologies. No issues, I'll try to explain about it.

AFAIK, You can not block a call or SMSs using J2ME APIs. Because MIDlet can only execute within "Sandbox". Now if you are trying to support this kind of functionality in your application, then you need to know about the market segment and the device penetration ratio in that market. So that you can build your app using different technologies. Let me give you more brief idea about it using an example:-

Suppose we are targeting XYZ market and the device penetration ratio is as following for that market segment:-
  • Nokia S60 & other Symbian  devices - 45%
  • Nokia S40  & other Java devices - 30%
  • Android, iPhone, Blackberry  & other devices - 25%
So now, you can target first 45% devices using the native Symbian app. For Android, iPhone we have APIs which provide the support to block a call with in the application. So you can also target these devices with native apps. Where as on Blackberry I am not sure about the APIs, which JDE version support the call blocking. You may dig into the Blackberry forums and may have a look on it.

Now the rest segment is MIDP devices, as you all know that we don't have any APIs to support call block functionality. But I can guide you with one workaround, may be it'll provide some help to you. To make a call block on MIDP devices, first you need to fetch the number from your contact list by making use of "TextField.PHONENUMBER" constraint and fetch the MSISDN and send it cross with some keyword like BLOCK on the specific number for your teleco client. Then on the server side you can do all the manipulation to block the MSISDN.

I hope I answered your question. If you still have some queries please let me know, I'll try to explain as per my knowledge on mobile application segments.

Google Dev Fest @ KL

Hi Readers,

Today I went to Google's Dev Fest @ KL, almost 400+ Google APIs fans were there. I hope everyone had great time @ Technology Park Malaysia, & really it was a great event. I learned a lot and hopefully I'll try to provide you some insight about Google's Dev Fest. So let's start:-

Google Dev Fest started with an introduction on what the DevFest day would cover by Christine Songco, Program Manager for Developer Relations @ Google & by Nazrul Kamaruddin, Community Manager at GTUG Kuala Lumpur.

After this, Daniels Lee a Googler who supports developers with Google MAPS Javascript API V3 ran through several code snippets & describe the various features list of V3, such as:-
  • Map Controls (Default UI, Position Custom Controls, etc.)
  • Overlays (Markers, Icon, Polylines, Ploygons, Custom Overlays, etc.)
  • Map Events (MVC properties with event handlers, UI events, etc.)
  • Map Services (Directions, Elevation, Geocoding, Street View, etc).
For more references you can have a look on these links, listed as below:-
  1. Google MAPs Javascript API V3
  2. Good Articles
Note: MAP API V3.0 doesn't require API developer key, & also Beta released for Places APIs but require API developer key to use in different WEB, WAP & Mobile apps. Daniels Lee also showcase one app that is developed using Google MAPs Javascript API V3. You can find app @ Where is Coffee? & source code for same app is available @ Coffee Source Code.

Presentation Links:-
This is all about first session of Google's MAP API V3.0 @ Google Dev Fest, KL. After this we had a presentation on HTML5 by Patrick Chanezon a cool Googler. He explained HTML5 quite impressible way, though during his presentation WiFi was not good. Few of the best points of HTML5 are listed as follow:-
  • HTML5 (HTML + CSS + JS APIs)
  • Web Storage
  • Web SQL Database
  • Web Sockets
  • Canvas
  • Audio
  • Video
  • New form field types
  • Canvas 3D (WebGL)
  • SVG in HTML5
  • New Font Support in CSS
  • Instant Web 2.0 Logo Creatr & many many more..
For all the HTML stuff please visit the presentation @ HTML5 Presentation. Some of the useful resources for HTML5 is as follows:-
  1. HTML5 Tutorial
  2. References
  3. Dive into HTML5
  4. HTML5 Demos
  5. HTML5 Drum Kit
  6. Effect Games (Based on HTML5)
  7. SVG Editor HTML5 based tool
You can also provide support for HTML5 on IE 6, 7 or 8 by using Google Chrome Frame. You can also have a look on Chrome Frame Developer Guide.

After this we moved towards the Open Social APIs, the session was taken by Tim & Bob. Team of two funky Buzz Googlers, who did so many funky stuff on stage to energies the audience after lunch especially to mention cartwheel by both Googlers on stage. This session is mainly based on Open Standards and Buzz APIs.  Buzz APIs really have good stuff and has loads of stuff built in. Essential components of a Google Buzz post are - the Identity, the Activity & the Object. Open standards are really cool and Google Buzz are using all of them in Buzz such as OAuth, RESTful calling style to access JSON data structures, oacurl etc. Even I am new to these APIs. So I suggest to have a look on the documentation. To know more about Buzz please visit the Buzz Docs. You can also have a look on few links listed as below:-
  1. Buzz Libraries & Sample Applications
  2. Boxee (Fully utilize Google Buzz)
  3. Buzz Bingo
You can have a look on the Googler's Presentation @ The Google Buzz API And You

After this healthy & interactive session, Patrick Chanezon is again on the stage with a session on Cloud Computing. He shared Google's presence in the cloud computing space & also shared the fact that 2 million companies use google apps to increase company revenues. Now I/O Chrome Webstore is renamed as Google Apps Marketplace & shares 20%  of Google revenue. Socialwok is an example of a enterprise apps on Google Apps Marketplace - based @ Singapore. Patrick Chanezon also suggest more people should use Google App Engine to serve static content.

Updates:- Cloud Computing Presentation 

Hey readers even I am also not much more into Cloud Computing stuff so not have more content to share with you guys. I just shared with you small stuff, but you can Google it and find the more relevant stuff on Cloud Computing.

In addition to this, few developers & companies showcased their products. Few of them are listed as below:-
  1. Chrome Extension for Google Dev Fest: Leonard Lee showcased the Chrome extension developed by him & totally based on HTML5, CSS, JS & JSON. You can install it from here -  Google Dev Fest Chrome Extension & information about Google Chrome Extension is here - Tutorial.
  2. Terato Tech: Terato Tech rocked the Google Dev Fest with their mobile app - "Undies: What are you wearing today?" This app is based on social networking & made a good use of Google MAP APIs for mobile applications.
I hope that I covered almost every section of the Google Dev Fest @ KL. If I forgot something or If you think that some information is not correct or not properly shared, so I apologies for that. You may correct me and  also let me know with your inputs and experiences @ Google Dev Fest.

Wednesday, July 14, 2010

How to make a call in J2ME?

Hi Readers,

Today while working on my blog, I came to know that someone of you are searching for article on "How to make a call in J2ME?". So this article is especially for that user. In this article, I describe you about how to use your phone book & make a call on that number, also you can directly enter any international format number and make a call. So let's start:-

Here I'll show you two things - 1) Fetch contacts from your device phonebook, & 2) Make a Call

1) Fetch Contacts from your device phonebook:
We can do this activity in two ways - a) By using JSR 75 API, & b) By using TextField property constraint.

First method is bit complex and it require signing of application from device vendor, to avoid security prompt while accessing the device phonebook. So we'll skip this method and directly switch to second option. In this you need to use one of the textfield constraint "PHONEBOOK" to access the whole contact list using J2ME app. The code is as follows:-

TextField numberTxtField = new TextField("Please enter the number:", numberString, 12, TextField.PHONENUMBER);

When you use this code in your app, then on real device when the focus is on "numberTxtField" you will see the commands to "Search" on Nokia devices & "Lookup" on Sony devices. Commands may be differ from vendor to vendor but the functionality is same - to access the contact list of the device. Using this code we are able to see the contact list from device and even also we can enter any international format number in the textfield at runtime.

2) Make a Call:
Now the next step, how to make a call from J2ME application. It's very simple and you need to use platformRequest() method of MIDlet class and pass the number with "tel:" string; which make sure that method is used to make a call. To check more on the URI scheme, please visit - http://en.wikipedia.org/wiki/URI_scheme

The code will look like this:-

private boolean makeACall() {
        boolean isCalled = false;
        
//used to read the number from textfield
        numberString = numberTxtField.getString(); 
        try {
            if (numberString.indexOf("+") != -1) {
                isCalled = this.platformRequest("tel:" + numberString);
            } else {
                isCalled = this.platformRequest("tel:+" + numberString);
            }
            try {
                pauseApp();
                notifyPaused();
            } catch (Exception e) {
                //Nothing to do..
            }
        } catch (IllegalArgumentException e) {
            isCalled = false;
            //Handle the functionality for wrong format of number
        } catch (Exception ex) {
            isCalled = false;
        }
        return isCalled;
    }

Now you need to call this function at the "Call" command using command handler interface, and if you are using low level APIs then need to handle the key events. So using this method you can handle the call functionality in your J2ME application. The users who are looking for this functionality can let me know with their inputs. 

Thursday, July 1, 2010

Cisco's Android-Based Cius Tablet

Hi Readers,

We all know that Android is a OS for mobile devices and we all are mostly expecting same. But on July 29, 2010 Cisco unveiled Android based seven-inch tablet PC named as Cisco Cius and redefine the Android space. The new Cisco Cius is an “ultra-portable, mobile collaboration business tablet that offers access to essential business applications and technologies.” Cisco's Cius has great feature list which brings it to the lime light with greatest & serious competitor to the Apple's iPad tablet. Apple iPad is best suited for content delivery and that's what it does best & used for by consumers. On the other hand Cisco Cius is all about enterprise. Now you are thinking that what features make it an enterprise tablet PC.

Cisco Cius Enterprise Tablet PC
Cius runs on Android and supports full integration of Cisco’s Telepresence technology with HD video conferencing support. The product and enterprise features are list for Cius Tablet PC as follows:-

Product Features:-
  1. The Cisco Cius is a lightweight portable business computing tablet offered with an optional HD audio station equipped with a telephone handset speakerphone, HD DisplayPort and USB ports.
  2. The Cisco Cius tablet features a front-mounted 720p HD camera which refreshes at up to 30 frames per second; a seven inch, high-resolution widescreen super VGA touch-target display for real-time and streamed video, and single-button TelePresence interoperability that can be utilized either when the tablet is docked, or being used remotely via Wi-Fi.
  3. The tablet has a 5-megapixel rear facing camera that can transmit streaming VGA quality video and capture still images, and dual noise-cancelling microphones for audio conferencing.
  4. Cisco Cius features an eloquent contacts-driven user experience, designed to enable users to quickly reach their important contacts.
  5. An on-board accelerometer readily orients applications for viewing in portrait or landscape modes as users rotate the device to their preferred viewing orientation.
  6. Cisco Cius supports 802.11 a/b/g/n Wi-Fi for enterprise campus mobility and 3G cellular services when off-campus. 4G services will be available at a later date. Bluetooth and Micro-USB means users can work untethered and share data with a PC.
  7. A detachable and serviceable battery offers eight hours of life under normal usage.
Enterprise Features:-
  1. Cisco Cius provides support for the comprehensive suite of Cisco collaboration applications including Cisco Quad, Cisco Show and Share, Cisco WebEx Connect, Cisco WebEx Meeting Center, Cisco Presence, and interoperability with Cisco TelePresence.
  2. Cisco Cius is supported by Cisco Unified Communications Manager and is easily integrated into existing Cisco customer environments.
  3. Cisco Cius helps ensure a more secure mobile collaboration experience by leveraging Cisco AnyConnect VPN Security, part of the Cisco Borderless Networks architecture.
  4. Virtual desktop integration provides IT organizations with the ability to host software applications securely in the data center and to utilize the Cisco network to deliver those applications 'as-a-service' anytime, anywhere. Cisco Cius thereby supports data center consolidation and reduced software licensing costs.
  5. Cisco Cius offers businesses the ability to take advantage of the ever-expanding ecosystem of cost-effective, third-party applications, supported by the Android operating system, while controlling user access policy.
  6. Cisco will help expand Android developed applications for business by offering Cisco Collaboration Application Protocol Interfaces (API's) to developers through a Software Developer's Kit (SDK).
Cisco's Cius vs Apple's iPad:-
One key difference between the Cius and the iPad is that Apple's tablet does not have both front- and rear-facing HD cameras. Cisco's open standards-based approach (Android) for Cius is also a differentiator between the Cius & the iPad, also the fact that it ties into Cisco's existing collaboration assets.

Note: In addition to this Cisco also unveiled another tablet for Home Energy Management solution which runs on Ubuntu.

Friday, May 21, 2010

Welcome Android 2.2 "Froyo"

Google just announced Android 2.2 "Froyo" based on Linux Kernel 2.6.32 at Google I/O Conference (Moscone Center, San Francisco), and the main features of this platform are listed as below:
  1. Performance & speed: The big addition is a Dalvik JIT (Just-in-Time) compiler, which brings a 2-5x speed boost to the system.
  2. Enterprise capabilities: There are also 20 new enterprise features, including better Exchange integration (for example: account auto-discovery and calendar sync) and device administration APIs which allow developers to write applications that can control security features of the device such as the remote wipe, minimum password, lock-screen timeout etc.
  3. Faster, more powerful browser: Google also demoed a new JavaScript engine in the Android browser, which is claimed as "the world's fastest web browser,". This has resulted in a 2-3X improvement in JavaScript performance vs. 2.1. It also has a Chrome browser plug-in that allows you to send directions from Maps on your desktop directly to your Android device.
  4. Rich set of new APIs and services: A new data backup APIs enable apps to participate in data backup and restore, allowing an application's last data to be restored when installed on a new or a reset device. Android 2.2 also features a new cloud-to-device messaging which help Android application to enable mobile alert, send to phone, and two-way push sync functionality. Now developers can declare whether their app should be installed on internal memory or an SD card. They can also let the system automatically determine the install location.
  5. USB tethering & WiFi hotspot: Android 2.2 will come with built-in tethering  and WiFi hotspot  support. That means your Android device can be turned into a portable Wi-Fi hotspot that can be shared with up to 8 devices. You can also use your Android-powered phone as a 3G connection for a Windows or Linux laptop by connecting their phone to the computer with a USB cable. The connection is then shared between the two devices.
  6. Additions to Android Market: Android Market provides Android Application Error Reports, a new bug reporting feature, giving developers access to crash and freeze reports from users. Developers will be able to access these reports via their account on the Android Market publisher website. I love this feature, It help developer to improve the Android application.
In addition to this, Adobe offers Flash 10.1 beta for Android 2.2 devices which has features like multi-touch and tap-to-zoom functions, the software also uses a "smart-zoom" capability to automatically size Flash content to the best width/height dimension for the device. To download the Android 2.2 SDK, please visit Android developer site. Before this you need to update the ADT (Android Development Tool) plug-in for Eclipse from ADT 0.9.6 to ADT 0.9.7

So lets start developing apps for Android 2.2 platform because some devices will get the update in the coming weeks.

Note: Android 3.0 platform or Gingerbread based on Linux Kernel 2.6.33 will be available in the fourth quarter of 2010 - http://tinyurl.com/2cowfsn

    Thursday, January 7, 2010

    How to get device IMEI number using JavaME for different vendors?

    The International Mobile Equipment Identity (IMEI) is a number unique to every GSM, WCDMA, and iDEN mobile phone, as well as some satellite phones. It is usually found printed inside the battery compartment of the phone. It can also be displayed on the screen of the phone by entering *#06# into the keypad on most phones.

    To retreive same information using JavaME is as follows:
    As you all know that, MIDP (Mobile Information Device Profile) when combined with CLDC provides a Java Runtime Environment and a rich set of Java APIS for cell phones. MIDP defines some System properties that are available to the midlet with  java.lang.System.getProperty(...) method. As IMEI is manufacturer specifc so there are few manufacturer specific APIs using which you can retrieve this info. Here's how to get IMEI number from mobile devices of different manufacturers:
    1. Nokia
      • System.getProperty("phone.imei");
      • System.getProperty("com.nokia.imei");
      • System.getProperty("com.nokia.mid.imei"); //especially for S40  devices
      Note: Requires signed MIDlet. S60 3rd edition device does not requires signing to fetch this info.On Series 40 phones this requires that your MIDlet is signed to either operator or manufacturer domain, and this is only available in Series 40 3rd Edition, FP1 devices and newer.
    2. Sony Ericsson
      • System.getProperty("com.sonyericsson.imei");
    3. Samsung
      • System.getProperty("com.samsung.imei");
    4. Motorola
      • System.getProperty("IMEI");
      • System.getProperty("com.motorola.IMEI");
    5. Siemens
      • System.getProperty("com.siemens.IMEI");
    6.  LG
      • System.getProperty("com.lge.imei");
    In addition to this, there are some generic information about the device that can be retrieved by using System.getProperty(propertyString) method call, where value of propertyString can be vary as per your requirement. Few of them are listed as below:-
    1. microedition.profiles
    2. microedition.configuration
    3. microedition.locale
    4. microedition.platform