Posts

Showing posts with the label SL4A

Android 1-Click Shortcuts using SL4A

Sometimes it takes 3-4 clicks to get to our often used settings page on Android phone, such as Mobile Network Settings (Settings - Wireless and networks - Mobile Networks). With SL4A , it's really easy to create a 1-click shortcut on the Home screen. 1. Create new script in SL4A, copy one of the following codes Shortcut to Mobile Network Settings (Use packet data, 2G/3G) droid = android.Android() droid.startActivity('',None,None,None,False,'com.android.phone','com.android.phone.Settings') Shortcut to Mobile AP/Tethering Settings droid = android.Android() droid.startActivity('',None,None,None,False,'com.android.settings','com.android.settings.TetherSettings') 2. Long press on Home Screen, choose Shortcut, choose Scripts, select the script you wrote on Step 1 3. Done :)

FBNotify.py

#coding=utf-8 #FBNotify.py: Facebook Simple Notifier # by Herry Limantoro (mataherry@gmail.com) # #NOTE: Don't forget to Add the Mechanize source folder into your SL4A scripts folder (/mnt/sdcard/sl4a/scripts) # http://wwwsearch.sourceforge.net/mechanize/download.html import android import time import sys import traceback import urllib import mechanize import BeautifulSoup import re droid = android.Android() #Setup Browser br = mechanize.Browser() br.set_handle_redirect(True) br.set_handle_robots(False) #User Agent, can't do without it br.addheaders = [('User-agent','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] url = 'http://m.facebook.com/notifications.php' #Set username password here, leave blank to prompt for username/password username = '' password = '' #Set run interval (in minutes), prompt if 0 interval = 0 def get_interval(): droid.dialogCreateAlert('R...

Android Facebook Simple Notifier using SL4A

Image
Like many Android phone users, I wonder why the Android Market Facebook app lacks push notifications like BB or iPhone. Currently it only notify when there is new message, or event and friend request. So, when I get acquainted with SL4A , this is the first app pop up in my mind. However, reading through the Facebook API and having to handle oAuth and stuffs seem just too much work. So, I thought if only I could open my mobile version of FB notification page ( http://m.facebook.com/notifications.php ) and read the new notifications, that would do it. And upon googling on emulate browser using python, I found these two excellent tutorials: http://stockrt.github.com/p/emulating-a-browser-in-python-with-mechanize/ http://www.ibm.com/developerworks/linux/library/l-python-mechanize-beautiful-soup/  I guess the neat trick is to "disguise" the User Agent of the mechanize Browser. From there on, it's basically parsing the HTML source behind the notification page. One last bit ...