Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Thursday, October 27, 2011

Cheapest Tablet in the World - Made in India

Check out "Akash" - World's cheapest tablet.  It is unabashedly optimized for cost. To be priced at $35 a piece (subsidized by Govt of India) for educational institutes and $60 a piece for retail sale.



Aakash Tablet from Venturebeat on Vimeo.

Specifications

  • Screen: 7-inches; 800-by-400 pixels; Resistive touchscreen
  • Operating system: Android 2.2, Froyo
  • Processor: 366 MHz Connexant; HD Video co-processor (both with graphics accelerators)
  • Memory: 256MB RAM (internal); 2GB Flash (external)
  • Storage: 2GB card included, expandable up to 32GB
  • Ports: Two USB 2.0; 3.5mm audio out jack; 3.5mm audio in jack (No built-in speakers)
  • Connectivity: GPRS; Wi-Fi 802.11 a,b,g
  • Power: Up to 180 minutes on battery; AC adapter, 200-240 volt
  • Weight: 350 grams

Monday, October 18, 2010

Frameworks enabling XP Engineering Practices on Android Platform

My recommended frameworks enabling engineering practices for android development:

  1. Test Driven development: Use android Test Instrumentation Framework (Android extension to JUnit framework)
  2. Automated Blackbox/Functional testing: Consider Robotium (Selenium for Android)
If you are interested, check these out (at your own risk)
  1. Automated Build: AndroidAnt
  2. (Alternate) Test Driven Development: Positron 
Hope this helps you in writing better Android Applications. 
Please feel free to drop a comment, if you come across any other framework enabling adoption of XP engineering practices on android development

Friday, October 8, 2010

Part II - Design patterns for scheduling a batch job in an Android Application

In my previous post we discussed usage of AlarmManager to schedule batch Jobs in Android Applications. In this post, we will dig dipper into design patterns specific to scheduled jobs executing resource intensive operations.

Any process having a Broadcast receiver object, is treated as foreground process and get's priority by Android Runtime. Consider a situation where you have a resource intensive process scheduled as a batch job. Let's say, the user has been playing a rich UI game (with significant frame changes/sec) when AlarmManager triggers your resource intensive job via the Broadcast Notification. Since BroadcastReceiver object gets priority in the order of execution, the user may experience slowness / lag in the application (i.e. the game in this case) running on the UI.

In order to circumvent this problem, it's recommended to design your batch job as a service within your application. Use AlarmManager to trigger the notification and let the BroadcastReciever start (or Bind to) the service to execute your job in the background. In this way, the user would not experience any impact on the application running on the UI. As with other components, don't forget to register the Service in the Manifest.

Sample code for registering a service in the AndroidManifest.xml

 
  
 


Refining further, one last scenario to be considered. What happens if your phone is already in a sleep-mode when the scheduled job gets triggered. Incidentally, you can set the 'type' parameter in the AlarmManager to wake-up the phone while Broadcast is being triggered. The Phone will automatically remain awake as long as the BroadcastReceiver is executing. However once the BroadcastReceiver object starts your service and completes it's scope, we run into the risk of the phone again going to sleep mode, there by stopping your (long running) background job abruptly.

To avoid such unpleasant situation, I recommend to obtain a Wake-Lock from PowerManager system service. Release the Wake-Lock after your background process completes successfully. This way you would ensure that your background process gets all due attention from the Android device.

Sample code for a service implementing a Wake-Lock
public class ScheduledPostService extends Service {

 @Override
 public IBinder onBind(Intent arg0) {
  return null;
 }
 
 @Override
 public void onCreate() {
  // initialize the scheduleTimer
  Log.d(Const.TAG, "Scheduled Post Service created");
 }
 
 @Override
 public void onStart(Intent intent, int startId) {
  
  // get a PowerLock
  // Retain the wake lock till this process completes
    
  PowerManager pm = (PowerManager) getSystemService(getApplicationContext().POWER_SERVICE);
  PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "SMSPost Tag");
  
  // Acquire lock
  wl.acquire();
  
  // perform your operation
  
  // Release lock
  wl.release();
 
 }
 
 @Override
 public void onDestroy() {
  super.onDestroy();
  Log.d(Const.TAG, "Scheduled Post Service destroyed"); 
 }
}

Don't forget to update the Android Manifest, giving permission to the application for using the WakeLock


Hope this has been helpful. Please feel free to share your experiences.

Thursday, October 7, 2010

Design patterns for scheduling a batch job in an Android Application

In this post, I will discuss design patterns for scheduling periodic jobs in an Android Native Applications. For illustration, i will be referring to sample code from my SMSPost project.


Let's start by discussing how to trigger a job at a predefined time? For many developers, Android Services becomes the default choice. However scheduling jobs through Services is not an optimal solution. Here is why
  • Running a service in the background all the time is a resource drain
  • There is a risk that Android may terminate the service in case of shortage in RAM (Refer to Android process and lifecycle)
Thankfully Android provides APIs to tap into Android system services. The AlarmManager System Service proves handy in this case. For scheduling your job, simply tap into the AlarmManager and schedule a Broadcast Notification event at the desired time. You have flexibility to schedule any date/ time or set fixed intervals for initiating the Broadcast notification. Your application should provision for receiving these asynchronous Broadcasts and perform desired operations.




Sample code for setting a Broadcast using AlarmManager 
try {
     Long firstTime = SystemClock.elapsedRealtime();
     Intent intent  = new Intent(this, AlarmReceiver.class);
     intent.putExtra("alarm_message", "Alarm Scheduled!");
     PendingIntent sender = PendingIntent.getBroadcast(this, Const.url_REQUEST_CODE, intent, 0);

     AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
     am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, 60*1000, sender); // set your own frequency
} catch (Exception e) {
     Log.e(Const.TAG, "ERROR IN CODE:"+e.toString());
}


Sample code for Receiving the Broadcast Notification
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
 // TODO Auto-generated method stub
  
 try {
      // your code for scheduled job goes here        
     } catch (Exception e) {
      Log.e(Const.TAG, "ERROR IN CODE:"+e.toString());

     } 
}

Up Next: We would explore design patterns further in specific cases where your scheduled job is expected to execute some heavy resource intensive operations 

Monday, September 20, 2010

Lotus Traveler on Android - Lotus Calendar

In this last post of the series (covering my experiments on lotus traveler software on Android client), I explored the Lotus Calendar application closely.



IBM follows the consistent minimalist design approach (consistent to Lotus Mail on Android) where by default you see the meetings scheduled for today. You would see today's day and the date (default color 'red') just below the Action Bar.

Upon invoking the Options Menu (Menu button on your Android handset) you get the following options
- Option to see events for 1 day, 1 week or 1 month
- Option to Sync the Calendar with the server
- Option to see events planned for today

Upon invoking the more option menu, you get the following choices

- Goto Date - A nice feature to look up your planned events for any specific future date
- New Events - Probably to create new calendar entry, was not available in the current beta release.
That means you can't create meeting invites from Lotus Calendar, but can view all existing calendar events after syncing up with server.


All in all, I was not overly impressed by the user experience. But it works!
All I wish is IBM opens up a few APIs to allow enterprises to do basic customizations as per their needs.

NOTE - Lotus Traveler for Android will NOT be shipped with Lotus Domino 8.5.2. Disappointed with the delay, I am waiting for next beta release.

Friday, September 17, 2010

Lotus Traveler on Android - Lotus Mail

Follow-up to my previous blog post, I explored Lotus Traveler on Android client in detail. Here are my findings on Lotus Mail

Folder Options:
  • Provides the following four folder options by default



    • 'Inbox'
    • 'Draft'
    • 'Outbox'
    • 'Sent'
  • Personal folders are not support yet (at least in the current beta)
  • Existing emails in the sent folders are not synchronized by default




Inbox:
  • Displays up to 5 emails (Only!) without having to scroll. Personally I would prefer to see a better use of available real estate 
  • Nice little message icon (highlighted) appears on the Action bar, whenever you have an unread mail. Nice feature to inform you about new mail, even if you are using some other application at the time email arrives
  • What is key here is IBM approaches a minimalistic design and you don't see any menu options upfront. You need to use the 'Menu' of your handset to invoke what we call in android world as the 'Options Menu' 

Available Actions:

By invoking the Options Menu, you get the following actions on the Inbox
  • Compose - (Needless to say) composes a new memo
  • Settings - Opens all application setting (including mail, calendar etc)
  • Show folders
  • Sync Now
  • Search Mail - Queer observation - Search mail, doesn't work unless your mail database is full text indexed (!) - but you don't get any such warnings. Not a high degree of user experience on the search












Other Observations:
  • Attachments of any kind are NOT Supported yet
  • Easy browsing through emails as you get some contextual actions to move to next email or delete the current email
  • Ability to search for names before adding to the sender list
  • IBM has not exposed any APIs to customize the current Lotus Traveler for android. Hence it's a closed package now, take it or leave it









Up Next - My observations on the calender feature of Lotus Traveler for Android



Tuesday, August 31, 2010

First Look: Lotus Traveler on Android - Installation

With ample support from of IBM, I got an opportunity to participate in the limited beta release of Lotus Traveler (what is it?) for Android client. Here are the steps to install Lotus Traveler client on an android device.

Step #1: Identify the environment:


  • Lotus Traveler for Android requires "Lotus Domino Release  8.5.2 Code Drop 5" or above
  • Download the Lotus Traveler server task from IBM (Run the Lotus Traveler executable and point to the existing Domino server). Once installed, Lotus traveler task runs as any other server tasks (like Http, POP etc) on the domino sever. (Please refer to the screenshot)
  • Unzip the content of the "Lotus Traveler client for Android beta" file into the Domino/data directory of the server
  • Append the content of "VersionInfoExt.txt" into the existing file "VersionInfo.txt"
  • Identify a Android device running Android OS v 2.0.1 or above

Step #2: Access the url "http://<ServerName>/servlet/traveler" using the standard browser from your android device, Provide the login credentials as required. On the landing page, Click on the link 'Select an IBM Lotus Mobile Installer'

You should see Android as one of the available platform Options (Refer to the image on right). Click on the "Android" platform Option.

IBM provides the following two *.apk (android package) files (which you would have placed in Domino\data directory of the server as per step#1)
  • LotusInstall.apk
  • Lotus Traveler.apk
Upon selecting Android platform Option, the LotusInstall.apk file gets downloaded to the android device.

IBM separates out Actual Traveler software from the Installation Package. My guess, you will install "Lotus Installer" app only once and it should in future periodically check for the latest release of "Lotus Traveler" app from the server and download if there is a newer version.

Step #3: Starting the Installation
Running the Lotus Installer program would initiate the download and installation of the Lotus Traveler client.

Before running the Lotus Installer program, verify the Domino Server configuration document. Check the value in Server Document -> Lotus Traveler -> External Server Url. This field should be Non-blank and should point to your domino server. Apparently the Lotus Installer Program picks up the server name from this field and checks for availability of Lotus traveler client in there. As per the latest from IBM, in future releases, this issue will be fixed.

Once the file is downloaded, you would be prompted to initiate the installation. Once installation is complete, you would see the following four icons on your android device (see the picture)

  • Lotus Calendar
  • Lotus Installer
  • Lotus Mail
  • Lotus Traveler

The top three icons are self explanatory. Lotus Traveler icon will be used for checking status and monitoring operations that cross applications.

As I understand there would be another Lotus Traveler icon in the future release named 'Name Lookup'. This application will help users in directory/contact look up.

There you go, you have Lotus Traveler client on your android device.
In future posts, I will share my findings on usability/ functionality aspects of the Traveler email client.


Further Reference:
FAQ: Clarifications on Android beta release - Ed Brill's blog
Link to participate in the beta release of Lotus Traveler for Android

Monday, August 30, 2010

Ruby on Android

All Ruby developers interested in Android development, check this out

Thursday, August 19, 2010

Android musings: Options for storing persistent data

Android provides the following options for storing application data:
  • Preferences: Store primitive data in key value pairs (a detailed explanation below)
  • SQLite database: Preferred approach if your application needs relational data. Further, android SDK provides sqlite3 tool, which enables you to manage the SQLite database from a remote shell
  • Internal Storage: Save data in a file directly to device's internal storage. By default this data is private to the application only. When the user uninstalls the specific application, these files are removed
  • External Storage: Save data in a file into a removable media (such as an SD card) or an internal (non-removable storage). NOTE: There is no security enforced on files written to external storage. All applications can read and write to such files. Moreover users can manually (or accidentally) remove such files
For my SMSPost project, I had the specific need of storing two persistent parameters, e.g. frequency of scheduled run and URL for SMS upload.

I chose Shared Preferences as the persistent data storage approach, purely because of the ease of use in handling preferences. Shared preferences, enables relatively static data to be stored as Key Value pair and the data is accessible to all activities and services in the application. (NOTE - You can share your preferences across other application by defining the preference mode as MODE_WORLD_READABLE or MODE_WORLD_WRITABLE. For SMSPost application, we just needed the data to be available within the application, hence we set the mode as MODE PRIVATE) 

Sample Code:



// get handle to the shared preferences (called from an Activity Class)
        preferences = getSharedPreferences(Const.PREFS_NAME, MODE_PRIVATE); 

// writing to shared preferences
       SharedPreferences.Editor editor = preferences.edit();
       editor.putString(Const.PUBLIC_STATIC_TIMEPICKER_IDENTIFIER, resultFrequency);
       editor.commit();

//Reading from shared preferences
       if (preferences.getString(Const.PUBLIC_STATIC_TIMEPICKER_IDENTIFIER, "") == "")
                        return false;




Source: SMSPost.java

Please leave a comment if you have used any of the data storage options and would like to share your experiences.

    Wednesday, August 11, 2010

    Android UI design patterns

    Good to see effort from Google towards bringing consistency in Android UI design. It was long over due.

    A must watch for all android developers.



    Please share if there are any other good resources on Android UI design.

    Tuesday, August 10, 2010

    SMSPost: My first open source project

    For quite some time now I have been working on developing a "native mobile application" on Android platform. Finally I have mustered the courage to publish the source code as an open source project.

    Details:
    Name of the Project: SMS Post
    Source Code: https://code.google.com/p/smspost/
    High-level Functional Requirements: Reads SMS from any android device and posts the content to a predefined website
    License: GNU GPL v3

    In coming days, I would share my learning from the project.
    Please leave a comment, if you would like to contribute to the project.

    Sunday, May 23, 2010

    My take on Google I/O - 2010

    Sunday afternoons are usually my preferred time to catch-up on my Youtube subscriptions. I put that to good use today, by checking out Google I/O - 2010.

    Vic Gundotra's interpretation of I/O (as in Google I/O) as "Innovation in the Open" pretty much set the tone for the event. As expected Google bundled a slew of new technologies like Open Media Project, GoogleTV, GWT 2.1 + Roo and renewed support for existing technologies like HTML5 and Google Wave etc. In the process Vic Gundotra and team took every opportunity to make subtle innuendos at apple's perceived "closed-technology" stack, skillfully showed solidarity with troubled tech players like Adobe and Opera and lined-up an impressive panel of venerable CEOs for support of GoogleTV.

    To me, the launch of Android 2.2 was the key announcement. Here are the salient features of Android 2.2:
    - New JIT compiler to the Dalvic VM - resulting in 3X speed
    - Tethering
    - New APIs - Cloud-to-device messaging, data backup
    - Updated web browser - with V8 engine, HTML5 support, Support for Flash 10.1 and access to more and more native apis
    - 20 new enterprise oriented features, integration with MS Exchange server
    - Updates to AppStore : Installing apps directly on SD Card, AppStore accessible from PC
    - AdSense for Mobile Apps

    My take, Google continues to maintain it's leadership position to define the future of the Web.

    Some may argue that Google has lost focus by trying to attempt too many things at the same time. But to me there is always a method to the madness. Having already attained absolute control of online advertising, Google is lining up products aimed at the way people will consume the web in future i.e Mobile (android), entertainment (GoogleTV, YouTube) and traditional PC based access (with Google Wave, Google App Engine) etc. Many of these technologies are bound to fade into the oblivion, but I am sure at least one of these technologies will stand the test of time and that would be a Game Changer.

    Hail Google!

    Sunday, May 16, 2010

    Designing Android GUI - Unit of measurement

    Android supports multiple units of measurement (such as Pixels, inches, millimeters, points etc). However the following two units of measurement are critical for a good design:

    - Density-independent Pixels (dp) - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.

    - Scale-independent Pixels (sp) - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

    As a best practice, never use anything but sp or dp unless you absolutely have to. Using sp/dp will make your Android applications compatible with multiple screen densities and resolutions.

    Sunday, April 11, 2010

    "Android is Apple's Burger King" - my perspective

    During my weekend browsing on twitter, I came across this interesting analogy comparing Apple vs Android to McDonald vs Burger King : http://bit.ly/a8ZSl2

    In the article Rob Diana argues
    - McDonalds leads innovation and consistency supported by detailed market study in selecting locations of their stores (comparable to apple's product innovation)
    - In contrast, Burger King follows a simple yet effective strategy of opening their store near to existing McDonald store and differentiates offering by allowing customers to choose the ingredients of their burger (comparable to Android's strategy of following iPhone with flexible hardware platforms)

    Here is my take:
    1. apple is undoubtedly the leading innovator in mobile computing. They are maximizing the tight coupling of hardware and software to deliver products that are more often than not prove to be game changer

    2. Android on the other hand is fast catching up, but I see following impediments to android's future growth
    - lack of control on underlying hardware: OS design is likely to get more and more complex (there-by inducing potential bugs) in future
    - As more and more manufacturers (without any differentiating value added services) adopt Android, it's only a logical conclusion that Android platform will be commoditized and cannibalized, their by allowing apple to strengthen it's lead

    It's high time that manufacturers like HTC, Motorola, Samsung, take a cue from "Burger King" model of being flexible in giving users what they want (at least in terms of innovation in service delivery, if not on technology)..

    Sunday, March 7, 2010

    Android Tablet

    For all first time tablet users:
    Before committing to the pricey apple iPad, here is a cheaper option to get familiar with tablets..

    FirstView offers $95 tablet, running on android 1.4 (??# - Well..there is a plan to upgrade to latest version of Android!)..comes fully loaded with wi-fi and 3G..

    Monday, January 11, 2010

    Android - Microwave & Laundry

    Touch Revolution has brought Android to home appliances. At CES Las Vegas, they showcased Nimble NIM1000 module, which allows OEMs to easily embed touch screen android into any home appliances.

    Checkout..Android Microwave


    Android Laundry:

    Sunday, November 1, 2009

    Andriod 2.0 on Motorola Droid

    Code named as 'Eclair', Android 2.0 has some interesting improvements.

    Check out the video on new features:



    Motorola launches Droid on November 6th (first smart-phone running Android 2.0), with some nifty features such as:
    - inbuilt app for gmail, facebook
    - Google navigation
    - plug in for flash 10



    Would Droid be the iPhone killer?