Android device access local host on laptop

android, json, ruby-on-rails

Solution

Use Your IP Address Instead of Localhost

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

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

Open System Preferences.

Go to the Network section.

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

Make sure your Rails server is running on port 3000.

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

192.168.0.14:3000

Hope that helps!

/ JP

Problem

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

Original source