SMS from android using python
Sending an SMS programmatically using python in an android easier than any other programming language
All one needs to have is Scripting layer installed in the mobile device.
Use the QR code below to get the apk and install the required and then install the python interpreter.
The below is the simple script to send random Chuck Norris jokes:
#!/user/bin/python """Send jokes to your loved ones""" __author__ = 'Hemanth H.M <[email protected]>' __copyright__ = 'Copyright (c) 2010, h3manth.com.' __license__ = 'Apache License, Version 2.0' import urllib2 import json import android """ URL to fetch a random joke """ JOKES_URL = 'http://api.icndb.com/jokes/random' """ List of number to which the joke must be messaged """ FRIENDS = ["9999999999","8888888888"] def getJoke(): """Returns a Joke ;)""" return json.loads(urllib2.urlopen(JOKES_URL).read())\ ['value']['joke'].encode('ascii','ignore') def sendJoke(): """ Sends the fetched joke to all your friends listed! """ joke = getJoke() print "here" print joke """ Give birth to droid """ droid = android.Android() for friend in FRIENDS: droid.smsSend(friend,"Random joke : " + joke) sendJoke()
As evident it uses the API provided by icndb. Yes lods of more scripting is possible with android and python, will be adding more.
Use can save and run the code using the QR code below [ Indeed scripting layer must be install on your device ]
Update : Apologies to incdb. few hours after this post, their DB went down due to loads of connections! [http://i.imgur.com/HSU2p.png]
Recent blog posts
- watir-webdriver web inspector
- gem list to gemfile
- Packing ruby2.0 on debian.
- Made it into The Guinness Book!
- to_h in ruby 2.0
- Filter elements by pattern jQuery.
- Better HTML password fields for mobile ?
- Grayscale image when user offline
- nth-child CSS pseudo-class Christmas colors
- EventEmitter in nodejs