Wednesday, 12 October 2011

Creating An Android Application For Your WordPress Blog

I came to know from one of my friends that building Android apps is no sweat but of course one should have an in-depth knowledge about two the computer languages mainly HTML and JavaScript. My field of expertise was working on web applications and those worked well on the web browsers, but I wanted to take up the challenge of creating an application for Android. I was successful in creating the Android application with my knowledge. I am sure you are eager to know about my recent feat and you are a first timer like I was, it may help you to begin.

About This Android Application

Let’s see what this wonderful app has in store for you. It basically is a feed reader and allows you to browse through the feed archives. The app allows you to save the articles in a reading list. The files that are saved can be read offline. On the page which shows you the entire details of the story, you can click on the download button, which allows you to download the entire story on your phone. If you want you may even save them in PDF format by clicking on the share option and choosing the save as PDF option. The application also allows you to search the blog and other sites using Google Custom Search and all this can be done from within the application itself.

Building Blocks For This Android Application

Do you want to know about the inside story behind the development of this Android App? I too am eager to share the same with you. First and foremost use the basic HTML tags to produce a page that suits you mobile.  To display data on to this page you will need to parse the RSS feeds from your existing WordPress installation. To deal with the styling you need to incorporate the jQuery Android library which makes the final app work seamlessly across various hand held mobile devices. This page will now need converting to an Android application (apk) by using a free tool called Phonegap.

Technical Information Related To Your Android Application

The application that I created used RSS feeds to fetch content from my WordPress blog but then it can work with any feeds for that matter. It is important that you acquire knowledge and familiarize yourself with the JavaScript library called jQuery and its mobile version called jQuery Mobile. This is a free library and you can get a huge amount of information regarding it online. You will get free tutorials and even applications being distributed online which uses jQuery and its native handlers.

The other important part in building this application would be your knowledge on table less HTML structures using div tags. That creates the different screens for the application using AJAX to fetch, parse and load content. The loading screen during page transition, the way the screen is laid out using cascading style sheets are generated using the jQuery mobile JavaScript library.

RSS Feeds – Your Database

You should know about RSS feeds as the application grabs the data to be displayed on the screens by parsing them. The feed requests to wordpress are controlled through the Google Feeds API, which parses the data for you. The benefit of using the Google API is that using it you can do away with cross domain security issues generally associated with JavaScript calls. If you want to display images in the application, your wordpress or the feed that you are using should contain the media elements in them. As the Google API does all the hard work for you by fetching and parsing the data, you need not worry about coding for cross platforms.

Your Android Application And WordPress

I used my Dropbox account to store the folder which contains all my images, JavaScript files and HTML files. The Dropbox folder on my local machine made the job of testing the application over various platform screens easier. As you may know Dropbox gives you a website link for your folder with public read access. This link can be used on any mobile or desktop web browsers. The most interesting part is that if you change your files locally, Dropbox will synchronize the files immediately and the changes are implemented across all browsers immediately. You will need to refresh them to view the changes.
If you need your application to be tested offline then you will need to use HTML5 local Storage; this is supported by all browsers. This feature has been used in my app to create the reading list feature. When to save the story, it gets stored in your local Storage area, that can thereafter be accessed offline.

Making The Android Application Compatible With HTML5

The jQuery mobile library provides the sliding transition effect to the pages but then it may appear with flickering effect. To do away with it, you can choose to use other effects. You should note the displaying embedding codes from You Tube videos may not work on HTML 5 canvasses on your Android. You will need to manipulate the codes to make them compatible with HTML5, so the IFRAME codes which are provided by You Tube will need to change.
When you are ready with your application and want to convert it into an Android application, you will need to convert the page using a tool called PhoneGap. This tool packs your HTML file, cascading style sheets, JavaScript files and images. The package is then converted into an Android application. For publishing these applications you can use readily available icons from the developer site hosted by Android. As the icons can be modified using Photoshop, you can easily modify them to make your own.

Advantage Of jQuery Mobile

The most important feature of using jQuery mobile is that your HTML document is made compatible across all major mobile platforms. The list includes Android, Symbian, Blackberry and iPhone among others. The same code base that you will use to create the application can be used for creating others.
With an Android phone you can open the apk file in your browser and the application will automatically install. You may need to change the application settings in your handset to allow applications from Untrusted sources to be installed in your Android. This will ensure that all apps that are not using the Android Market can be installed in your Android phone.

Conclusion

This is just a very basic version of an Android application. There may be bugs and they will need to be ironed out. Various other features can be added to it, to make it more user friendly and functional. That may be something for the future.

No comments:

Post a Comment