1

i have an android application works on emulator and connect to server localhost , send an receive data, i want to make my application on real mobile and connect it to localhost via wireless, i am using servlet to connect from mobile android emulator to localhost server, what is the changes i have to do? and can I connect to localhost via wireless or i have to buy a real host?

Vao Tsun
  • 47,234
  • 13
  • 100
  • 132
Totti
  • 665
  • 5
  • 12
  • 26
  • 2
    why don't you use the local ip address to connect to server? – ColdFire Jun 30 '12 at 15:07
  • 1
    @A.A i don't understand what do u mean, but i want to make a graduation project and i want to make my doctor see the application on a real mobile – Totti Jun 30 '12 at 15:08
  • 2
    Not sure what you are asking there. But if your phone is on the same local network like your development server, then your phone can access your PC via its IP address or host name and the other way around. localhost is by the way an alias that points a network client to itself. – tiguchi Jun 30 '12 at 15:08
  • 1
    @NobuGames and if i were on the same network , i just have to connect to the server via server's ip , nothing else? – Totti Jun 30 '12 at 15:09
  • 2
    well, u used to connect to the local host via 10.0.2.2 in stead you can use the PC IP address to connect to the server as long as your phone and your PC are connected to the same network – ColdFire Jun 30 '12 at 15:10
  • 2
    That is correct. Hostname resolution should work too – tiguchi Jun 30 '12 at 15:10
  • 1
    @A.A yes you right , i am using 10.0.2.2, now i have just to put the pc's ip instead? nothing else? – Totti Jun 30 '12 at 15:11
  • 2
    This post for xampp, must help. http://stackoverflow.com/questions/822902/access-xampp-localhost-from-internet – Aqif Hamid Jun 30 '12 at 15:12
  • 2
    no nothing else just the PC's IP address – ColdFire Jun 30 '12 at 15:12
  • 1
    @AqifHamid can i understand that i have to make some steps on the PC? not just add the pc ip instead of 10.0.2.2 ? – Totti Jun 30 '12 at 15:13
  • 1
    @A.A great great , and please i want to buy android mobile , can u suggest mobile for me? :) – Totti Jun 30 '12 at 15:14
  • 1
    and is it hard to install application on real android mobile? – Totti Jun 30 '12 at 15:15
  • 2
    well, it depends on how much money u want to spend..and it is very easy to install you app on the phone.. it's just like testing it on the emulator you jut hit run – ColdFire Jun 30 '12 at 15:16
  • 2
    check this link to have some idea about price range http://www.myshopping.com.au/PT--31_Mobile_Phones_Android__fs_41957_p2_e__ – ColdFire Jun 30 '12 at 15:20
  • 2
    you're welcome and good luck with your graduation project :) – ColdFire Jun 30 '12 at 15:24
  • @A.A i found HTC 1V, 4.0, did u thing it is good? – Totti Jun 30 '12 at 17:16
  • 1
    yes i think it's good.. here's a link for full specs http://www.htc.com/uk/smartphones/htc-one-v/#specs – ColdFire Jul 02 '12 at 10:32

1 Answers1

0

Firstly, check the URL and change the IP address from that of the local server to local IP address. Make sure that the mobile device is in the same network with the computer to access the script that fetches the API. Then service the request to get the results in terms of Javascript Object Notation (JSON).