i have an app(ruby on rails) running great on my desktop(localhost) which can recognize a request from a browser/mobile phone.Can i check it on my mobile phone too,without using android emulator.Just by hitting my ip will help me out????
Asked
Active
Viewed 996 times
3 Answers
1
rails s
is by default binding to all interfaces on your desktop.
So if you know the IP address of your desktop (look it up in ifconfig
) you can simply use that IP to access the Rails application.
eg: http://192.168.0.100:3000
.
You then inspect the user-agent to find out it's a mobile phone or not.

Tigraine
- 23,358
- 11
- 65
- 110
-
Anyway I would suggest `thin` webserver, since WeBrick is somehow slow for remote connections. – Tomáš Dundáček May 28 '13 at 07:32
-
Is webrick not siutable for mobile app...By the word **thin**,what does it main???@Tomáš Dundáček – May 28 '13 at 07:35
-
well i tried from opera browser from my mobile device,i am getting error as **Cannot connect to the remote server**...@Tigraine – May 28 '13 at 07:37
-
Is your mobile phone connected to your WiFi? – Tigraine May 28 '13 at 07:38
-
no ..it has a 3G connection and i can see google homepage too..@Tigraine – May 28 '13 at 07:40
-
You need to connect your Phone to your *local network* in order to be able to connect to your desktop by IP address. 3G won't work. – Tigraine May 28 '13 at 07:42
-
i am in my office..so is there a case that my office's proxy may be a obstacle between my mobile app and the server OR may be some other reason..should i try it in my home instead...@Tigraine – May 28 '13 at 07:43
-
yes im hitting at http://192.168.0.100:3000...for example ...on port 3000..still the same error..i found the ip from my host file entry..@Tigraine – May 28 '13 at 07:45
-
What does it mean by connecting my phone to a local network..how can i do that..(using USB)...@Tigraine – May 28 '13 at 07:47
1
The rails server can be started with the b
flag which specifies the IP address you want to use:
rails s -b 0.0.0.0

Josh
- 5,631
- 1
- 28
- 54

Indrajeet Mishra
- 105
- 1
- 1
- 8
0
deploy your app to heroku or AWS and use git to maintain your app code...Then you can connect to your phone using internet
-
right now,without worrying about the deployment..can i access it on my phone..if yes than HOW????@polurupraveen – May 28 '13 at 08:24
-
You have to connect your phone to your local network.. I repeat local network not internet – May 28 '13 at 08:34
-
thanks for the reply..but What does it mean by connecting my phone to a local network..how can i do that..(using USB).???..@polurupraveen – May 28 '13 at 08:40