Android Facebook Simple Notifier using SL4A

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 ( and read the new notifications, that would do it. And upon googling on emulate browser using python, I found these two excellent tutorials:

 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 is detecting the bullet list character as the indicator of new notifications, which actually made me lost in encoding decoding -.-. Oh ya, I couldn't work out the wakeLockAcquirePartial and wakeLockRelease without messing up the sleep timer. So I ended up just calling wakeLockAcquirePartial to keep the CPU run all the time while the phone is locked and screen is off. But well, at least it works :D. And oh, have I said I did all the coding and debugging on my Samsung Galaxy Gio phone :P?

Here is what you need to do:

(You can click the links, or you can just scan the barcodes)

1. Install SL4A and Python for your Android phone


2. Download Mechanize for python (stable zip), extract, copy only the mechanize source folder to SL4A scripts folder on your phone (/mnt/sdcard/SL4A/scripts/)

 3. Download the script and save it to SL4A scripts folder

For those having trouble getting it from dropbox

4. Try it out, let me know if it doesn't work, Enjoy :D and tell others

5. Drop me a comment or e-mail me or join the SL4A Discussion Group


  1. Hi MataHerry. How shoud I copy the folder of the python scripts into the script folder ? Using DDMS in Eclipse I am able to copy only one file at a time.

  2. Hi varsha, you can copy files by connecting to the phone in USB drive mode.

  3. Bang bagaimana caranya install python mechazine di androi.please help me bg


Post a Comment

Popular posts from this blog

Get Images Bookmarklet

Nomor Telepon PSTN (Pulsa Lokal) Call Center Bank-Bank di Indonesia

iFrame Opera Extension (Updated for Opera 39)