Get Started Now

Python and Android for Barcode Scanning and Automating Controls

If you wanted to use the Android to do a little python scripting, then you can use the  PythonAndroidAPI through the Android Scripting Environment (ASE).

Matt Cutts shows a six-line proof of concept barcode scanner sent to him by Vijayakrishna Griddaluru, republished below. Also, Included are two more examples of  android-scripting.

Sample BarCode Scanner

import android
droid = android.Android()
code = droid.scanBarcode()
isbn = int(code['result']['SCAN_RESULT'])
url = “http://books.google.com?q=%d” %
isbn droid.startActivity(’android.intent.action.VIEW’, url)

Changing Ringer Volume

droid.getRingerVolume()
droid.setRingerVolume(5)
droid.setRingerSilent(True)
droid.vibrate(100)  # 100 milliseconds of vibration

Dialing numbers

droid.dialNumber("8675309")

More Code Snippits

There is a Android Snippits site available, but all of the code seems dedicated to Java at the moment. You can follow this blog to get more updates and participate in the discussion on the ASE google group as things develop, no pun intended.

  • Share/Bookmark

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>