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:


"""Send jokes to your loved ones"""

__author__ = 'Hemanth H.M <[email protected]>'
__copyright__ = 'Copyright (c) 2010,'
__license__ = 'Apache License, Version 2.0'

import urllib2
import json 
import android

""" URL to fetch a random joke """

""" 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())\

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)

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! []

Share this