I just wanted to ask how to connect to the localhost when the app is installed in mobile? I tried installing the apk of the android app in my mobile phone instead of the emulator of android studio. My app has a login and register activity. In the emulator, I'm able to register and login while I cannot register and login using my phone. Thanks in advance for the answer!
            Asked
            
        
        
            Active
            
        
            Viewed 189 times
        
    0
            
            
        - 
                    2Possible duplicate of [Accessing webserver running within Eclipse from outside the workstation](https://stackoverflow.com/questions/1621796/accessing-webserver-running-within-eclipse-from-outside-the-workstation) – TmTron Nov 14 '17 at 13:48
- 
                    2Possible duplicate of [How do I connect to this localhost from another computer on the same network?](https://stackoverflow.com/questions/9682262/how-do-i-connect-to-this-localhost-from-another-computer-on-the-same-network) – melanzane Nov 14 '17 at 13:49
- 
                    Edit your question and add the new changes you have attempted so far. – Sudheesh R Nov 14 '17 at 15:18
1 Answers
1
            
            
        There are a lot of answers exist, but in simple follow the steps below.
- First try to connect both your pc and mobile devices in the same network. 
- Then find the ip of your pc (run - ipconfigin command prompt if you are using a pc).
- Place this ip as your base url in your app and use register/login endpoints as per your need. - For eg: http://your.ip.here/register.php like this > (http://192.168.0.2/register.php) 
- Now run the app, it'll connect to the above said ip. 
 
    
    
        Community
        
- 1
- 1
 
    
    
        Sudheesh R
        
- 1,767
- 3
- 23
- 43
- 
                    1No offense but sometimes I'm really baffled how many people develop network apps without knowing any networking basics like this!? – xander Nov 14 '17 at 13:58
- 
                    1I think they don't like to study the basics first. In my experience a good developer should be a good learner too. – Sudheesh R Nov 14 '17 at 14:05
