can't access Internet from 3.2 emulator - android

I'm developing an android app where I need to connect to some server & download data from the server
using http get
it works perfect on 2.3.3 emulator
but I test on 3.2 it works as if there's no connection ... any help ?

In Android Emulator's setting set the IP of your system
1.Click on Menu 2.Click on Settings 3.Click on Wireless & Networks 4.Go to Mobile Networks 5.Go to Access Point Names 6.Here you will Telkila Internet, click on it. 7.In the Edit access point section, input the IP and 8080 Proxy
Hope this will work

I Found the solution
actually 3.x Android OS doesn't allow to make network operations in the main Thread
so I had to make multithreading using AsynTask

Related

What connection use emulator in android studio?

Android studio has its own settings for connection. There I can use proxy. So this way studio will use that proxy instead of computer wifi connection to sync libraries for example.
But for example if my application I send requests to the firebase what connection will be used by emulator? It will use studio proxy or it will use computer wifi for that? And if I use real device will it use mobile internet connection or proxy?
I have tested all scenarios. So the answers are the following.
Everything local depends on local WIFI of the laptop. Android studio has opportunity to set up its own proxy but also wount work without wifi. Android emulator has a wifi spot calls AndroidWifi in settings which indicates laptop wifi.
The real device use its own connection. So these are to separate different parts. If there is no connection on laptop but there is on real device. So you can't add library but you can launch based on HTTP requests app on real device.

(Unity) Network manager not working on android device

I added GameObject. To this object I added two components. (Network Manager and Network Manager Hud). Created cube and added Network Identity(Local Pl.Au). In Player Prefab added cube and deleted from scene. Finally I build&Run on windows. And it works well on windows. when I connect my real Android phone it installed successfully but when I tried press Lan Host or Lan Client it is not responding.The phone is connected to the laptop using a USB cable. What am I missing?
LAN Host or LAN Client will work on your PC, because your PC knows what a LAN is.
Your android device, on the other hand, does not.
To match your android device with another device or your PC, you will have to use a match making service.
To develop and try your app, you can use Unity's match making Service, which can be used in a limited fashion with a Unity Personal license.
When using the NetworkManagerHUD tool, the "Enable Match Maker" button will take you there.
You will need to do a bit of setup to turn on Matchmaking Service on your unity account and server before you can try.
Go to Window > Services.
Perform the necessary steps to create or use your current organization and project, and enable Multiplayer.
You can use LAN on Andriod, you just have to enter the IP address of the Host device into the box where it says "localhost". To be clear, replace "localhost" with IP address of host device( can be andriod or PC)

Why can't I connect to IISExpress from my Android device?

I am trying to connect to a ASP.NET WebApi service running on IISExpress through Visual Studio from an Android emulator (Genymotion specifically). I was able to set up my IISExpress bindings and firewall (as shown in posts similar to this and this) so that I could access the website externally.
I was able to successfully navigate to the service from another laptop on the network, but am still unable to accomplish it from the browser in the emulator or my own Android device (also on the network). When I try this I get a generic "Web page may not be available" message. Why can I access it from other external machines, but not the mobile devices?
Turns out Android is not able to resolve Windows hostnames so when I set up the binding to use my machine name it did not work. Once I changed it to use my IP address it was fixed.

Debugging android app on phone against local dev server (Google Endpoints) fails to connect with router

I've an android app installed on my phone (debug build) and a local dev server. The app is using GAE Endpoints. I've updated the API builder by adding
b.setRootUrl("http://[myIP]:8080/_ah/api");
However, the app cannot connect. I've verified the dev server is up and running.
As a test, I tped
http://localhost:8080/
in by browser and I get the api explorer, etc.
However, if I do
http://[myIP]:8080/
I get "this webpage is not available". So clearly that must be the root cause.
The way I get my IP address is by running ipconfig in a cmd.
I tried turning off my firewall but that didn't make any difference.
Any and all help much appreciated. Thank you.
Figured it out.
i have a router so need to go into my router settings and add a 'virtual server' (that feature may be called something else for your router) redirecting from my ROUTER ip address (not what you get from ipconfig), and a port (whatever you want, need to use it in the setRootUrl), to my server address (what you DO get from ipconfig) and the local dev server port (typically 8080)
when i start my server in Android Studio i need to specify address 0.0.0.0, can be easily done in Android Stuiod by editing the run config (don't forget to restart it after that change)
update b.setRootUrl to point to the router ip address from 1. and the port you picked in 1. as well (don't forget to rerun your app after the update which will re-install it on your phone)
disable firewall -- however that's unsafe so instead i've created a special rule for this connection. (when setting inbound rules, a big gotcha is that there are usually predefined rules to block ALL connections from Java SDK/JRE for all installed versions on your system which will take precedence. You would need to modify those: I wouldn't advise disabling the whole rule, but you can modify to specific ports as such Ports: 1-[your server port-1], [your server port + 1, 65535].
The combination of those four works for me. Hope this helps someone!

How can I connect to a proxy on Android?

I have a Samsung Galaxy S, running on Android 2.2
I want to track all HTTP requests (from both browsers AND apps) with Charles (proxy installed on my computer).
I would like it similar to how it is on the iPhone where you go to settings, wifi, and on the right connection you can select the HTTP proxy settings
You can do it with Wireshark: http://www.wireshark.org/download.html
Here are instructions for Mac + Android device:
Launch Terminal and run the following commands:
cd /dev
sudo chmod a+r bpf*
Connect to the internet using an Ethernet cable
Click on the Airport/Wi-Fi icon at the top right of the screen and select Create Network; remember the name you give this network
Go to System Preferences, open the Sharing pane, highlight (but don’t check) Internet Sharing
Select Share connection from: Ethernet, To computers using: check AirPort/Wi-Fi
Click AirPort/Wi-Fi Options, and enter the network name you chose above (it should be displayed automatically, so just click OK)
Check the Internet Sharing box
Click Start
Connect your Android device to the network you just created
Launch Wireshark
From the menu, select Capture -> Interfaces. Click on Options next to en1 (or whichever one shows a Wi-Fi icon)
Click the Capture Filter: button
If you want, choose one of the filters, such as HTTP TCP Port (80) and click OK
Click Start
There is currently no out-of-the box proxy in Android. Several alternatives are discussed in this page. Also google for "Android proxy" to see what other alternatives are out there.
ProxySelector
Some alternatives to have partial support of proxy in Android are listed here: http://issue1273.blogspot.com. There is also an Android Proxy Library that try to abstract the access to proxy settings for every Android version.
A very nice write up on the procedure for setting up Charles with Android can be found here, including installing the certificate so you can also debug / proxy your SSL traffic:
http://jaanus.com/post/17476995356/debugging-http-on-an-android-phone-or-tablet-with
Since Android Studio 3.0 release, android now support setting proxy natively.
See documentation.

Categories

Resources