dcsimg

Writing an Android Twitter Client with Python

Get up and running with the Android Scripting Environment. Whip up a Twitter update app in a matter of minutes and tell everyone what sandwich you're eating from within Android!

There are many Android tutorials on the Internet and books in the bookstores showing how to write applications — I know, I’ve read many of them and have even been fortunate enough to have the opportunity to write a few myself. Up until this point, every Android application I have seen has been written in Java with a few of the more intrepid tutorials covering the topic of getting a “C” application to run on Android.

While writing applications in Java and the Android SDK is really pretty easy for a coder with an interest in learning the SDK, there is a bit of a learning curve in getting the tools setup, navigating the SDK and getting your application to run happily on the device. If you are looking to write an application for the Android Market, using the SDK is the way to go.

But what if you are interested in just hacking around a little on the device itself? What if you’re looking for a mobile Internet device that you can program anywhere — even while you are waiting patiently at the doctor’s office?

With the Android Scripting Environment, you can do just that! If you are familiar (or willing to learn) Python, Lua, or BeanShell, you can write applications directly on your Android device — no laptops, no compilers, no kidding. Follow along as we learn about the Android Scripting Environment and create a script in Python to submit entries to your Twitter account.

Android Scripting Environment

The Android Scripting Environment (ASE) installs to your Android device just like any other Android application. You can download the ASE installation file from its project page on googlecode.com. I have the alpha 0.7 version of ASE installed on my development phone.

You can use ASE to write applications much as you would in any Linux environment. Interact with the user, perform calculations, connect to the Internet. You can even access a subset of the Android SDK functionality from the scripting environment such as reading Android’s sensors and launch other applications. This flexibility allows an experienced developer (or script writer) to customize the Android environment without having to go the SDK development route. Scripts can be installed as a Service to be available at all times or be even triggered by the Locales plugin.

Once the ASE application is installed and launched on your Android phone, you will see the “Script Manager” where all activity is initiated.

Script Manager
Script Manager

The ASE installs with a handful of sample scripts which demonstrate basic scripting functionality. Clicking on any of the scripts will start the script in a new terminal window using the appropriate script interpreter engine. The file extension determines which interpreter is launched.

For example, a script with a “.bsh” extension is processed via the BeanShell interpreter. To create a new script, select the menu button and choose “Add”. If you want to enter script commands directly into the interpreter, choose the “Terminal” menu selection. You can choose from each of the supported and installed script interpreters. To edit or delete an existing script, perform a long-click (press and hold) of the selection.

Script Editing Actions
Script Editing Actions

Note that you can also create a shortcut on the home/launch window. This is helpful if you write something useful (of course you will!) and want to be able to launch it quickly. I created a shortcut to my “Twitter Status” script, which is in the script file named ts.py.

Script Editing Actions
Script Editing Actions

It is time to have a look at our script. To test this script, you will require an Android device (or emulator) with internet access. As already mentioned, you can edit scripts directly on the device through the ASE ScriptManager code window, however you may not want to type all of the code directly into your device. Good news — you can simply copy the file to your device as a starting point.

Next: Confessions of a Python Newbie

Comments on "Writing an Android Twitter Client with Python"

Here is a good Weblog You may Uncover Interesting that we encourage you to visit.

Usually posts some incredibly intriguing stuff like this. If you?re new to this site.

We came across a cool website which you may well take pleasure in. Take a search if you want.

Please pay a visit to the internet sites we follow, including this a single, as it represents our picks in the web.

That may be the end of this report. Right here you will obtain some websites that we consider you?ll value, just click the hyperlinks.

One of our guests recently suggested the following website.

One of our visitors lately proposed the following website.

We came across a cool site that you could possibly love. Take a search in the event you want.

Wonderful story, reckoned we could combine a number of unrelated data, nonetheless definitely worth taking a appear, whoa did one discover about Mid East has got much more problerms at the same time.

Always a large fan of linking to bloggers that I appreciate but really don’t get lots of link appreciate from.

Usually posts some extremely interesting stuff like this. If you?re new to this site.

Just beneath, are numerous completely not related internet sites to ours, nevertheless, they’re surely worth going over.

We came across a cool web-site that you simply could get pleasure from. Take a search when you want.

The facts mentioned in the write-up are a few of the ideal available.

One of our visitors a short while ago suggested the following website.

One of our visitors just lately proposed the following website.

That may be the finish of this write-up. Right here you will obtain some websites that we feel you?ll enjoy, just click the hyperlinks.

Here is a good Blog You might Uncover Interesting that we encourage you to visit.

Wonderful story, reckoned we could combine a couple of unrelated data, nonetheless definitely really worth taking a look, whoa did 1 study about Mid East has got extra problerms too.

Here are some links to sites that we link to because we believe they are really worth visiting.

Here are a number of the sites we recommend for our visitors.

Just beneath, are many absolutely not related internet sites to ours, even so, they’re certainly really worth going over.

The time to read or check out the subject material or web-sites we have linked to below.

Very couple of internet sites that happen to be detailed below, from our point of view are undoubtedly well worth checking out.

The colors of the season are alive on a sleeveless dress that
will look at home on any girl. The Tunics, Dresses and Wedding Dresses line are
all desiged for the eco-minded woman who is looking
for long lasting quality in a fashionable green piece.
The color of the sock should be aligned with the color
of the pants and the shoe. The organization gives women skills and tools to get back into
the work force, allowing them to sustain a life, sustain their children; take their lives to the next level; finish
school and go to school. If you have already found the designer dress
of your dreams but it is too far out of your price
range, why not take a photograph (from a magazine,
for example) to a dressmaker and see if he
or she can make their own version of it. Dresses for girls are tops,
party dresses, t-shirts, shirts, sweatshirts, bottoms, coordinated sets, traditional wear, sweaters, jackets, night wear,
inner wear and swim apparel.

Here is a great Blog You may Obtain Fascinating that we encourage you to visit.

That may be the finish of this report. Here you will locate some web pages that we feel you will enjoy, just click the hyperlinks.

Please check out the web sites we follow, which includes this a single, as it represents our picks from the web.

Wonderful story, reckoned we could combine a couple of unrelated data, nevertheless definitely really worth taking a look, whoa did one study about Mid East has got far more problerms also.

That would be the end of this article. Here you?ll come across some internet sites that we assume you will appreciate, just click the links.

One of our visitors not too long ago recommended the following website.

Below you will locate the link to some internet sites that we believe you’ll want to visit.

Fantastic article.Much thanks again. Really Cool.

I truly appreciate this post.Really thank you! Really Cool.

The facts talked about in the post are some of the most beneficial obtainable.

The time to study or check out the content material or internet sites we have linked to below.

Please visit the sites we follow, like this 1, as it represents our picks through the web.

Check below, are some completely unrelated internet websites to ours, nonetheless, they’re most trustworthy sources that we use.

Very handful of sites that happen to be in depth below, from our point of view are undoubtedly well worth checking out.

Here are some of the sites we recommend for our visitors.

What i do not realize is if truth be told how you are no
longer actually much more well-favored than you may be now.
You’re so intelligent. You already know thus considerably on the subject of this subject,
made me individually consider it from a lot of
various angles. Its like women and men aren’t fascinated except it is something to do with Girl gaga!
Your own stuffs great. All the time handle it up!

Every once in a although we opt for blogs that we study. Listed below would be the newest sites that we decide on.

Very few sites that come about to become in depth below, from our point of view are undoubtedly properly worth checking out.

Very few internet websites that take place to be in depth below, from our point of view are undoubtedly well worth checking out.

That is the end of this write-up. Here you?ll find some internet sites that we feel you?ll enjoy, just click the links.

Check beneath, are some entirely unrelated websites to ours, nonetheless, they are most trustworthy sources that we use.

Just beneath, are quite a few completely not related web-sites to ours, nonetheless, they’re certainly really worth going over.

Every the moment in a though we decide on blogs that we read. Listed below would be the newest web sites that we pick out.

We came across a cool web site that you just may well get pleasure from. Take a look should you want.

Every after inside a whilst we opt for blogs that we read. Listed below would be the latest web-sites that we select.

Leave a Reply