Powered By Blogger

Wednesday 23 May 2012

Creating a local server on the Android phone.

Lets us unleash the potential of the ANDROID BEAST!!!- 1st exercise

     Creating a server so that we can access the directories of our like from the phone directly through the browser!! no need of USB cable and the sluggish Kies (coz i own a Samsung galaxy S ) (:

Step1:  To find IP address of the phone.
  1.     Open SL4A application(find the installation guide here )
  2.      Tap the "menu" key then "View"
  3.     Select "Interpreters"
  4.     Open the "Shell"

        Make sure internet is working. Type "netcfg" in the shell, now the result will be something like this:                       

            lo              UP        127.0.0.1       255.0.0.0       0x00000049

             svnet0     UP         0.0.0.0           0.0.0.0         0x000000d1                            

             ifb0          DOWN  0.0.0.0          0.0.0.0         0x00000082                            

             ifb1          DOWN  0.0.0.0          0.0.0.0         0x00000082

             usb0        DOWN  0.0.0.0          0.0.0.0         0x00001002                            

             sit0          DOWN  0.0.0.0          0.0.0.0         0x00000080                           

             ip6tnl0    DOWN  0.0.0.0          0.0.0.0         0x00000080                            

             eth0         UP        192.168.1.6     255.255.255.0   0x00001043                    

      Leave the first line "lo" and look for the remaining having "UP" next to them. In my case the IP is 192.168.1.6

Step2: Create a script having the following code:

     import SimpleHTTPServer
     from os import chdir
     chdir('/sdcard/DCIM/Camera/')
     SimpleHTTPServer.test()

Save and Run the code and open the browser on your computer and type:

           your IP address:Portaddress i.e, 192.168.1.6:8000 in my case.

By default android uses port address 8000.
Now u should be able to see the contents of the "Camera" folder. You can change this to any other directory. Right Click on any link and save it.

       Hope you enjoyed it:)

In Love with SL4a on my android :D

      SL4A basically is a layer to access few of the Google APIs easily through scripting languages. I will be using Python. 

Why SL4a?? 
       Imagine your phone replacing all the sensors which you normally use GPS, GSM,Light sensor,Proximity sensor, Accelerometer, Magnetometer,Camera,WiFi, Bluetooth,Text to Speech and Speech to text.......and many more...
 

Installation (cake walk)

  Easy way
    Download SL4a from this link  http://code.google.com/p/android-scripting/ on the phone by clicking the QR code.

  Easiest way
     Just open the above link on your computer and point your phones Bar code scanner to the QR code it will do the job for you. :)

    Once it's finished downloading, tap the download notification to start the installation process as you would for any other downloaded APK. Install it. It will appear just like the other APPs on your phone. Open it,

     Only shell is included with the SL4a install. Other interpreters must be installed separately. To add another interpreter:
  1. Press the menu button
  2. Tap "View"
  3. Tap "Interpreters"
  4. Press the menu button
  5. Tap "Add"
  6. Select the interpreter you would like to install(Python in our case)
     Once it's finished downloading, again tap the download notification. To start the installation click on the install button wait for a while till few more files are downloaded.

Troubleshooting
  • Make sure you are connected to the network.
  • If there is a problem try installing again following the above steps again.
 Stay tuned to do interesting projects with your phone. : )

Thursday 26 April 2012

Rube GoldBerg contraption I

     Our first contraption in the college fest (2009). Applying all the "physics" we knew:) but contraptions are hard to build and synching each and every step is a challenge. With my buddies Akhil,Divesh and Nithin it didn't seem so difficult, it was fun and the experience gained is just awesome:)

Here is the video enjoy: