Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android device access local host on laptop

I am new to android and backend development and came in a problem today. I have setup rails server on my computer and localhost:3000 shows ruby page. My android device (connected by usb) main activity has a webview and I tried localhost:3000

like image 335
user2891198 Avatar asked Feb 05 '14 00:02

user2891198


1 Answers

Use Your IP Address Instead of Localhost

Instructions if you're on a Mac. Other OS's, do something comparable.

  1. Connect your computer and Android tablet to the same Wifi connection.

  2. Open System Preferences.

  3. Go to the Network section.

  4. Click on your Wifi connection and copy your IP address from that window:

    Network Settings

  5. Make sure your Rails server is running on port 3000.

  6. On your tablet, point to your computer IP address with port 3000,

    192.168.0.14:3000
    

    Navigate on your tablet

Hope that helps!

/ JP

like image 147
Joshua Pinter Avatar answered Oct 05 '22 22:10

Joshua Pinter