Monthly Archives: October 2010

Introduction to App Inventor for Android

App Inventor for Android is a tool for creating applications for Android platform. But it is different. It doesn’t require you to write code to develop an application.

Usually, application development involves programming and in case of Android one has to program in Java. This tool, App Inventor, on the other hand doesn’t require you to program. Using this tool you can create applications for Android without writing a line of code!

How can an app be created without writing the code? The answer lies in another question: What does the code do in an app?

The code does two things:

  1. Defining components i.e. defining things like widget, Button, Label, TinyDB, screen arrangement, notifications etc. Components can also be called objects or instances.
  2. Defining and controlling the behavior of these defined components.

App Inventor achieves the above two objectives without any programming. In App Inventor you can define the components and their behavior visually through a user interface.

App Inventor has a Designer and a Blocks Editor. The Designer defines all sorts of components and the Blocks Editor defines the behavior of these components.

Let me quickly take you through the Setup Process and the Development Environment of App Inventor.

Setup Process

The App Inventor is a web-based tool and works on all major browsers. Therefore the setup is very minimal. Following are the basic requirements for running App Inventor:

  • Contemporary operating systems and browsers.
  • Java Run Time Environment 1.6 (i.e. Java 6).
  • App Inventor Extras Software: Installer/Package is available on the home page of App Inventor. One can easily download and install it.
  • USB Connectivity with USB Debugging enabled: The setup requires you to have USB Debugging enabled in your phone and a working USB connectivity. To achieve the same you need to install drivers for your phone. The Extras Software package includes drivers of a few common Android devices and after installing the same you might not need to install the drivers manually. If this doesn’t work, you can manually install the drivers by using the CD you got along with your phone.

I found the setup pretty easy. I was able to get App Inventor working very quickly.

After completing the setup you can quickly test your setup. Create an empty project and then clicking the Connect to Phone from the Blocks Editor should launch the stub application on your phone.

Development Environment

It has two parts Designer and Blocks Editor. Designer defines the look and feel of your application. You can drag and drop the objects (buttons, textBox, media, sensors etc) from the palette to the screen and arrange them as desired. All this is done visually.

App Inventor Designer Window

 

After completing the design you can open the Blocks Editor from the Designer. In the Blocks Editor window you can define the behavior of the components which you added previously. In this window, you will have various types of Blocks associated with the components e.g. OrientationChanged-block of OrientationSensor-component, the block where you can do call your other blocks to get the notification when the orientation changes.

App Inventor Blocks Editor

This was a quick introduction of App Inventor. And in the next part of this post I will explain how to create a simple application for Android using the App Inventor.

Debugging Console for GuiClient/QXmpp

QXmpp repository contains many examples. One of them, GuiClient, is a full-fledged graphical XMPP client. I developed it for testing out the functionality and usability of the QXmpp API. This example supports most of the XEPs (XMPP Extension Protocols) supported by QXmpp.

To ease up the debugging, I have added a console dialog to display all the sent/received stanzas. Have a look at the Debugging Console.

 

qxmpp-debugging-console

Debugging Console

 

  • Settings button can be used to launch this dialog.
  • User can control the logging by using the Enable Check Box.
  • Sent and Received messages are color coded to differentiate between these.
  • The Clear button clears the text area.

Got Invitation of App Inventor for Android

Yesterday, I got the invitation to try the pre-release of App Inventor for Android. App Inventor is a tool which allows users without any programming skills to create applications for Android platform. Instead of writing the code, one has to visually design the user interface and create blocks to control the behavior of the application.

I will try it out and create something using the App Inventor. Wait for my next post for the review or may be a tutorial.

More about App Inventor from the team:

Welcome to App Inventor!

About App Inventor:
App Inventor for Android allows people with minimal programming experience to create simple, personal apps for Android devices. It has a number of features which ease app development. App Inventor is best suited for people who are eager to learn the basics of programming and are interested in making basic apps for their personal use.
Remember the Beta Tag:
App Inventor is currently available as an invitation-based beta product. We are limiting access in order to ensure that our systems can handle the load. As a beta product App Inventor still has rough edges and missing features. In some cases the rough edges include un-pleasantries such as: installing Windows device drivers, installing Java on your computer, and fiddling with settings on your phone. We are working hard to smooth out the rough edges and we appreciate your use of App Inventor while we are in this beta state. It may sound a bit cliche but it really is true, your use of App Inventor today will help us make it better for the future! Now on to the good stuff.
Getting Started with App Inventor:

Complete these 3 steps to start using App Inventor:
  1. Set up your phone and computer.
  2. Connect your phone to your computer.
  3. Complete the basic tutorials.
Take your App Inventor knowledge to the next level by:
Happy Inventing!
Google’s App Inventor Team

Implementing XOR Encryption

At times, you need a simple encryption and decryption functionality to secure sensitive information. In my case, I needed to store passwords on disk to implement the “Remember Password” functionality of the GuiClient example of QXmpp.

Instead of going for a 3rd party library where you just need a very basic crypto functionality I will suggest using XOR encryption. XOR encryption is pretty easy to implement. I will also present my implementation of this algorithm using Qt C++.

XOR (Exclusive OR) Encryption or XOR Cipher is a simple symmetric encryption algorithm. It operates according the principle that XORing a data twice with the same key results in the same data.

The first XOR of the data and key gives the encrypted data. Then the decryption involves XORing the encrypted data with the same key.

EncryptedData  = Data ^ Key
Data =  EncryptedData ^ Key

Data: data to be encrypted
Key: secret key or password
EncryptedData: data after encryption
^ represents Exclusive-OR (XOR) operation

Example:

Let us use two binary numbers for Data and Key. The 

Data  = 01101
Key   = 10101

Encrypt:

EncryptedData = Data ^ Key
EncryptedData = 01101 ^ 10101
EncryptedData = 11000

Decrypt:

Data = EncryptedData ^ Key
Data = 11000 ^ 10101
Data = 01101

Implementation of XOR Encryption in Qt C++:

QByteArray calculateXor(const QByteArray& data, const QByteArray& key)
{
 if(key.isEmpty())
   return data;

 QByteArray result;
 for(int i = 0 , j = 0; i < data.length(); ++i , ++j)
 {
   if(j == key.length())
     j = 0;// repeat the key if key.length() < data.length()
   result.append(data.at(i) ^ key.at(j));
 }
 return result;
}

Queen's Baton Relay in CWG 2010

Queen's Baton and Penguins

Following the tradition of Commonwealth Games. The 2010 Queen’s Baton Relay commenced on Oct 29, 2009 at Buckingham Palace. The Baton covered a distance in excess of 190,000 Kms in 340 days. It traveled 70 nations in 240 days and reached India on June 25, 2010 through Wagah Border from Pakistan.

After covering all the states of India in 100 days and traveling 20,000 Kms it finally arrived at its penultimate destination Gurgaon.

I was very excited to know that 2010 Queen’s Baton, after traveling all over the world and bearing a great traditional value also covered the street next to my home. Fortunately, my parents and nephews watched the mega event and became a part of it.

The Baton has now headed for Jawaharlal Nehru Stadium, Delhi to conclude at the opening ceremony on Oct 3, 2010. Where the message contained in the Baton will be read aloud to officially open the 2010 Commonwealth Games.

Facts about the 2010 Queen’s Baton:

  • Inbuilt camera and voice recorder.
  • GPS enabled to track its location.
  • It has LEDs which displays colors of the flag of the current country.
  • SMS capability.
  • It is the longest relay in the history traveling 71 countries, covering 1,90,000 Kms in 340 days.
  • The Queen’s Baton 2010 Delhi is created using processes and technologies existing in India by Michael Foley of National Institute of Design, in partnership with Titan Industries and a technology consortium led by BEL.

Baton Tracks in World Map

71 Nations – 190,000 Kms – 340 days

World Map of Baton Tracks

Baton Tracks in India Map

28 states & 7 UTs – 20,000 Kms – 100 days

India Map of Baton Tracks