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"

Every once in a even though we pick blogs that we study. Listed beneath would be the latest websites that we decide on.

We like to honor lots of other world-wide-web sites around the web, even when they aren?t linked to us, by linking to them. Beneath are some webpages worth checking out.

One of our visitors just lately encouraged the following website.

Very few internet websites that come about to become comprehensive beneath, from our point of view are undoubtedly very well worth checking out.

We prefer to honor lots of other net internet sites on the internet, even when they aren?t linked to us, by linking to them. Beneath are some webpages really worth checking out.

Every after in a even though we decide on blogs that we read. Listed below would be the newest websites that we select.

Usually posts some really exciting stuff like this. If you are new to this site.

Please stop by the sites we comply with, including this 1, because it represents our picks in the web.

We came across a cool web-site which you may possibly love. Take a search in case you want.

We prefer to honor quite a few other world-wide-web internet sites around the web, even when they aren?t linked to us, by linking to them. Under are some webpages worth checking out.

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

Here are some of the web sites we advise for our visitors.

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

Here is a great Weblog You might Uncover Exciting that we encourage you to visit.

The time to read or visit the content material or sites we have linked to below.

I simply want to mention I am just newbie to weblog and seriously enjoyed your web blog. Likely I’m going to bookmark your site . You absolutely come with exceptional articles and reviews. Cheers for sharing your webpage.

The facts talked about inside the article are some of the most beneficial readily available.

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

Always a big fan of linking to bloggers that I appreciate but really don’t get a lot of link enjoy from.

Please go to the sites we adhere to, like this a single, because it represents our picks from the web.

Here is a great Weblog You may Uncover Exciting that we encourage you to visit.

We came across a cool web-site which you may possibly get pleasure from. Take a look for those who want.

Here is a superb Weblog You might Come across Interesting that we encourage you to visit.

Every once inside a when we pick blogs that we study. Listed beneath would be the newest sites that we select.

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

Here is a good Blog You may Discover Interesting that we encourage you to visit.

Here are some links to internet sites that we link to since we feel they are worth visiting.

Although web-sites we backlink to below are considerably not related to ours, we feel they may be truly worth a go by means of, so possess a look.

We prefer to honor several other internet sites around the web, even when they aren?t linked to us, by linking to them. Under are some webpages worth checking out.

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

Cherished is likely to be what people say about your comments.

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

Please check out the web sites we adhere to, which includes this one particular, because it represents our picks through the web.

Please take a look at the sites we comply with, which includes this 1, as it represents our picks from the web.

That may be the finish of this report. Here you will find some internet sites that we believe you will value, just click the hyperlinks.

Usually posts some incredibly exciting stuff like this. If you are new to this site.

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

Here are some of the websites we advise for our visitors.

The time to study or pay a visit to the content or web pages we have linked to below.

We prefer to honor numerous other internet internet sites on the net, even when they aren?t linked to us, by linking to them. Underneath are some webpages really worth checking out.

Just beneath, are numerous completely not connected web pages to ours, having said that, they are certainly worth going over.

This is a beautiful choice for mens gemstone wedding rings.
That is an amazing ring by Triton, a trusted brand in the marriage ring business
for many years. This diamond ring is stripped tungsten with channel set diamonds.

The diamonds in this ring are stunning absolutely.
You get what you purchase with these Triton jewelry definitely.
The tungsten of this ring is a copyrighted formula from
Triton actually. This formula is 85% tungsten.
The method creates a hypoallergenic, heavy, strong,
durable, and tarnish immune material. This is a stunning durable band, and most of Triton’s bands are protected by a forever fit warranty.
Should anyone ever expand out of your diamond ring or receive your band with imperfections they will give you a new one for
free.
Another great choice for mens diamond wedding rings is this 8mm tungsten comfort-fit
group with diamonds. That is a great comfort-fir band with
very accurate sizing, and they come in two sizes. The tungsten materials is ideal super and finished damage resistant.
In addition to the amazing sturdiness of the tungsten, the ring is hypoallergenic.

Another good mens diamond wedding rings choice is this
beautiful 925 dark-colored rhodium plated sterling-silver
engagement ring. This wonderful wedding ring has five diamond jewelry with a total gemstone weight of 0.75 carats, and the gemstones are channel-set.
The diamonds come from conflict-free mining which is a huge
plus always. This ring comes with satisfaction guarantee where you can
return or exchange any order within thirty days.

Product will come in a beautiful high-quality gift package.
Here we’ve a lovely tungsten band with a sterling metal center.
This diamond ring includes 0.20 carats of natural white diamonds.
You can find 7 channel-set high-quality diamond jewelry.

The colour grading of these diamond jewelry is H-I I-2
quality. Ring is comfort-fit, and 8mm vast. The tungsten
of this engagement ring is super strong and durable. It is also scratch resistance.

The details mentioned within the report are several of the ideal out there.

Here are a few of the web sites we advise for our visitors.

Although web-sites we backlink to beneath are considerably not related to ours, we feel they are actually really worth a go by way of, so have a look.

Even though her mom and sister, Primrose, are at present protected in watch The 33 online (Jeremiah)
bunker-like confines of District thirteen , Peeta is caught in the Capitol’s clutches.

Here are a number of the web-sites we advise for our visitors.

Very few sites that take place to be detailed beneath, from our point of view are undoubtedly well worth checking out.

Just beneath, are a lot of entirely not connected internet sites to ours, even so, they’re surely worth going over.

Wonderful story, reckoned we could combine some unrelated information, nevertheless really really worth taking a search, whoa did 1 study about Mid East has got extra problerms too.

Leave a Reply