Android Emulator - How to set bypass proxy - android

We have an application which need to connect to 2 server. One of those 2 only has pulbic ip address while other one only has private ip address. (Asking for both to have public or private now is impossible)
To connect to public address, we need to go through our company proxy. But we need to bypass proxy to connect to the private one.
So does Android emulator provide options to set bypass proxy for certain site like browser.
Thanks and Best regards

Related

Android: How to call apis in mobile with sub-domain from local system

I have a Rails application running in my laptop and an android application on phone. I want to call apis of rails application where routes are namespace with sub-domain.
My api look like below:
http://api.localhost:3000/login (With sub-domain)
When I replace localhost with ip address. It will work in browser but in android application it gives me Android java.net.SocketTimeoutException: failed to connect. But when I namespace without sub-domain it works.
http://192.168.1.101:3000/api/login (Works fine)
What is the correct URI with sub-domain ?
http://api.192.168.101:3000/login (Gives above error)
The easiest way to solve the problem is if you have a domain registered. You can add a DNS entry for hostname api.192.168.101.
If not, you have few options.
Setup your wireless router to resolve the hostname api.192.168.101 to 192.168.1.101. I am assuming, your phone's DNS server is your wireless router. If your wireless router does not support adding local DNS entries checkout the next option.
You have to add the entries to "/etc/hosts" file of your Android phone. It is easy for rooted phones
I suggest you consider buying a domain from a good vendor who provides you a decent DNS management console.

Accessing ASP.NET web service from android

I have created a basic web service and I need to access it from android but somehow the web service is only accessible on my local machine, with a local URL like http://localhost:4012/MainWebService.asmx but outside my machine when I try something like 187.120.36.4:4012/MainWebService.asmx the 187.120.36.4 being the IP of my machine hosting the asp.net web service it doesn't go through, all my googling efforts have not paid off so far. So any help will be highly appreciated guys and thanks in advance.
First you need IIS Server. This is how to enable it on W10.
Next you need to configure you ASP project to run on the IIS server.
Now you should be able to access your webservice on 187.120.36.4:4012/MainWebService.asmx.
BTW. That looks like your external IP. Are you sure it is correct? I would suspect something like 192.168.x.xxx
If your machine is connected to a router then you need enable port forwarding on your router to your local machine and then run your web service in your local machine.
After you have it set up your connect url will be http://<your public ip address>:port number where public ip address is your router's external ip address.

how to convert private-ip address to public?

(192.168.0.103) this is my private ip address. I want to convert my private address to public. I am running apache-tomcat in my machine to provide service for my android application. Please help me out what i need to do?
I take it that you mean, 'how do I access an internal machine on my subnet externally'.
Determine the public IP address of the apache server by visiting a site that will show the public IP address (such as www.whatismyip.com).
In any firewalls between external and your apache server, set up port forwarding to the apache server. This will require you to map the inbound connections to your internal server.
On the local firewall on the apache server, make sure that inbound connections to the apache server are enabled.
Connect from your android device to your apache server using the public IP address from 1 and the port set up during port forwarding in 2.
Note: -
Be very careful about exposing internal devices to the public internet and allowing access into your subnet. Make sure that you server is secured correctly. Consider putting the server in a DMZ.
Unless you have a static IP address, the public address is likely to change.

how to access a localhost website from android device

I have an ASP.net Web API in my laptop with this address :
localhost:99949
I add this to IIS Express that I can access my web Api from another computer in same lan network , and it's going this:
Nimis:80
I can access to my web api from other PCs , but when I try to access this with my android device it show me "Web page not available" error.
I turn off all my firewalls.
what should I do to fix it ?
You need to add an inbound rule in the firewall for port 80 (or whatever port you used for your website on IIS):
Go to Control Panel, Windows Firewall
Select Inbound Rules
Add a New Rule
Select "Port" as a Rule Type
Select "TCP and put "80" (and any other ports you want to open) in "Specific local ports"
Select "Allow the connection"
Select the network location where the rule should apply
Give a name and an optional description
After that you should be able to access your site from other devices in the same network using http://computername (e.g. http://myhomepc)
However you might need to use the IP of the server machine with Android. It always seems to override its DNS entries using Google's servers. In this case try to modify DNS settings as explained here.
I had the same problem and this is my solution without changing anything in FireWall or any other settings:
Get the IP of the WebService deployed by IIS-Express (run IIS-Express): For this install the extension "Conveyor" in Visual Studio: Tutorial on Youtube
To check if it is working open browser on your mobile and type in the IP shown in Conveyor: IP of WebService --> e.g. I typed URL: "http://192.168.178.51:45455/api/ToDo" to get the correct HttpGet from my Rest-Webservice
To have it running in Android Studio I used a normal HttpURLConnection (Same URL also runs on Emulator!)

With localhost running on my desktop right now,can i view it on my android phone(samsung/lg etc)

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????
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.
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
deploy your app to heroku or AWS and use git to maintain your app code...Then you can connect to your phone using internet

Categories

Resources