My Android app cannot connect to localhost after setting APN - android

I have setup a local server running on 127.0.0.1/3000 on my MacBook. My Android app sends requests to 10.0.2.2/3000 to make connection with the server. This works pretty well until I configured the APN in the Android emulator settings. In the APN settings, I set the Proxy to be 192.168.x.xxx and the port number to be 8001. With these settings, the local server is not able to accept any messages sent from my app now. Closing the APN proxy is not an option because my app also needs to connect to some remote services. So how to connect to the local server with APN proxy on?

I find the answer. Instead of listening on 127.0.0.1/3000, I configured my local server to listen on 0.0.0.0/3000. Instead of making request to 10.0.2.2/3000 in my Android app, I now make request to 192.168.x.xxx/3000. The local server now can accept messages sent from my Android app.

Related

Connect an Android app to localhost without internet connection

i have an Android app that needs to access offline a MySQL database that's hosted on my localhost (i'm using WampServer).
i can't use USB tethering or port forwarding because my laptop won't have internet connection too.
what can i do?
You can setup wifi, connect your system which contains server and your android device to same wifi. Assign a static IP to your server system and let your android connect to that server's MySql through the IP you assigned. Basically it is nothing much different then your web api and db hosted on cloud server and your android application connect to that cloud using either the domain or ip.

Cordova - connecting to a proxy server

I have a cordova application targeting both iOS and android platforms. Under certain conditions, when the user, who is in a specific group, logs in to the application (using normal his data plan), I want all the HTTP calls to be router through a proxy server which has an authentication based on username and password. I need to know how do I enable the application to connect to a proxy.
thanks

How to log HTTP and HTTPS traffic for mobile devices like Android and iOS?

I have the following setup:
Mobile Clients (Android and iOS) are communicating with 3 servers directly using HTTPS rest requests with json body.
I want to host a server in the middle and send all requests when the application is used in one of the non-PROD environments and log every request and response. In real time the developers or QAs to open a web page and see in real time every activity the application is doing.
Also: Apply some filters, for example only requests to a specific address, or everything but specific address. Apply delays and change the request/response body or status code - like in Fiddler.
In order to achieve this today I have to host Fiddler or Charles proxy and setup the computer as proxy server to every device.
What can you advise me to use?
You can host a Fiddler proxy on your server. Also in the Fiddler settings, don't forget to mark the 'Decrypt HTTPS' setting if you want to see the HTTPS traffic.
Fiddler will give you a certificate which you will need to install on mobile devices so that Fiddler can decrypt HTTPS connections.
Set your proxy in the Wifi settings.
Make sure that your app uses the proxy settings which are set in the Wifi Settings. I have seen some apps which ignore the proxy settings.
you can setup a wifi proxy server and ask all the the devices to connect through that wifi proxy server...Now you can monitor traffic on that proxy server...
On Linux server you can use squid to setup wifi proxy -http://computernetworkingnotes.com/network-administrations/squid-server.html
To setup wifi proxy on android device go to Go to Settings/Wi-Fi-> "Show advanced options"-> "Proxy settings" and choose "manual"

Communication between app and server over cellular network

I'm developing an Android application that communicates with a Rails server. When the application is run on the same network as the Rails server, everything works well (I can access my database on the server). However, when I use the 4g internet on my phone, I can't connect with the server.
My question is, how can I modify my Android app/Rails server so that my Android app can contact my rails server without having to be on the same network?
Thanks in advance!
Make sure you're not starting the server in development mode. Generally, in development mode the server accepts by default only requests from the same machine (no network connections are accepted).

what changes i have to do to make my android application work on real mobile

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?
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).

Categories

Resources