Else lets go, If you're rocken linux get the sdk
#If need be read my first post on getting java 32bit or the 64bit version with ia32-lib installed
#Using the barcode scanner install SL4A and Python for Android Both programs need to be installed.
#Installing the SDK
$ tar zxvf android-sdk_r15-linux.tgz
$ android-sdk-linux/tools/android #execute the installer

#Select Tools, Android 4.0.3 and Extra, you should have around 14 packages in the bottom right hand corner to install.
#Once installed on the phone click on Settings -> Developer options

# Under Developer options Select USB debugging and Stay awake

#Back in Ubuntu in your home directory "cd" into ~/android-sdks/platform-tools directory and add the following script to a file called adbserver.sh, don't forget to chmod ug+x adbserver.sh
#adbserver.sh server script to start python server on android
./adb shell am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER \
-n com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher \
--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT 45001
port=`./adb logcat -d | grep "Bound to" | tail -n 1 | grep '127.0.0.1' | sed -e 's/.*://g'`
./adb forward tcp:9999 tcp:$port
export AP_PORT=9999
echo "server started on port:$port"
export AP_PORT=9999
echo "server started on port:$port"

(for some reason the USE_SERVICE_PORT option doesn't work, however the script takes care of this)
#On the phone from the top window drop down you can see the server running. It's in dark grey and extremely hard to see.

#If you click on the server listing, it will bring you to the following screen showing the server port on 42409

#We need to move android.py from the phone to python2.6 ubuntu's python2.6 dist-packages directory. Make sure python2.6 is installed.
$ ./adb pull /sdcard/com.googlecode.pythonforandroid/extras/python/android.py .
$ sudo cp android.py /usr/local/lib/python2.6/dist-packages/
#Add the following to hellosms.py and run it using python2.6
import android
droid = android.Android()
droid.smsSend("9999999999", "testing") #replace 9999999999 with your number
$ python2.6 hellosms.py
#You should get a text from yourself to yourself and you're done! I hope this helps.
No comments:
Post a Comment