Android UnresolvedHostException on real device using servername - android

Hi I am developing an application which is connected to a cooperate network via a VPN-connection.
Now I have the following problem:
If I try to send a HTTP-Request from a real device to a server located in the network using the server-name the logcat shows an UnresolvedHostException.
If I am using the IP of the server instead everything works fine as expected.
On the emulator the problem does not appear at all and everything works.
So I tested this on the browser of my device and the browser seems to have the same problem, using the IP, the browser can access the server, but if I use the server-name the browser returns a 404 error.
Does anyone have a clue why this problem is appearing or can give me a hint how to solve this issue, I have searched the web but cannot find a proper solution anywhere.

If anyone is having the same problem, shutdown your device wait a moment so it totally powers of and then restart it, this solves the problem and saves you a lot of time, stress and rage, it seems like their is a bug in the system (at least on some API versions)

Related

I can not access my notebook with my Android using IPv4

I'm having a bad problem and it already gave me a headache. I did an application with Magic Software and to run it on my Android I have to configure Magic Studio the right way (done), run the project on the Magic server (done and working) and install MagicDev.apk on android (available in the Magic XPA folder and already done), and when finished installing, the application must be run and when it is executed it asks to enter the URL of the Magic application, which is the following: http://[IPv4_of_notebook]/MagicScripts/DevProps.txt, but when you try to access this, it is not possible, it says that the application was not found or the connection failed.
It is worth mentioning, I had this same access problem when using XAMPP or Wamp, because when trying to access the localhost with the cell phone, the link would not respond, it would load until I gave the message (I put Wamp online for this, of course, and changed the settings in the [files].conf). Another important thing is that I made an Android application in Android Studio where one of its functions was to access the internet and although the application installed on Android really could not connect to the link, the emulator accessed quietly (the emulator runs inside the pc, would there be anything?) and I could do what I had to do, this link was on a page I made using Wamp, that is, the emulator accessed my IP, and the cell phone can not.
My question: Is this some configuration of the notebook, Android, Internet router or am I doing something wrong? My friend created a page using Wamp, configured it correctly and placed it online and from my home, with his IP, I accessed the page (with my notebook) in a quiet way. One more note, my notebook connects to the internet with Wifi and my Android too, meaning they are not connected to the source directly as my room PC is, and I do not know if that also matters.
I will later try to run the application on my PC from the room and see if it gives him access to his IPv4, but I do not think it will work either. Anyway, does anyone have any idea what it can be? I do not like messing with my notebook's Internet and other settings without knowing what I'm actually doing, I'm afraid to make my notebook vulnerable. Here in this video https://www.youtube.com/watch?v=1njzFq07t2U you can see the process I'm describing here, but it's not working for me.
I already figured out the villain, it was the firewall. When I turned it off everything worked as expected. I can not keep it turned off for security reasons, but from what I've seen I can configure it to accept only my phone.

Android phonegap connect to WCF service across domains

I have a phonegap 3.4 app written for android 4.4.2. My code for communication with WCF service works accross domains, as i have checked with my PC, and it also works in the emulator. However, when I try to open my app on the phone, the data transfer never finishes- I neither get success nor error in my ajax call. Same thing happens if I open the html file in my phone's browser.
I had avast on my phone, but i turned it off, and I cant see what else might be interfering. So any help would be greatly appreciated.
(Please keep in mind that my javascript-wcf communication works across domains, so I doubt that changes to my ajax or wcf are nescessary, at least I hope so.)
Apparently, something went terribly wrong in my eclipse. Downloading pure eclipse and then installing adt plugin to it solved the issue.

Localhost page not found when not connected to internet on Rhomobile application

I have an application build with Rhodes that runs well in many kinds of devices.
But, in a Samsung GalaxyTab with Android 3.2 it has a problem (GT-P6210).
The device doesn't have 3G, only Wi-Fi.
When Wi-Fi is enabled, it works fine.
When Wi-Fi is disabled, it works for some minutes and so it shows a page saying "Web page unavailable" and shows the URL (http://localhost:53899/app/....) exactly the same screen that appear on the Android's default browser when it do not find an URL.
If I copy the URL and go to the browser and try to access it so the page is loaded normally.
Do somebody has any idea of what could be happening?
Thanks in advance.
On Launchpad there's currently a proof of concept to fix this:
https://developer.motorolasolutions.com/message/11817#11817

PhoneGap app start ends with timeout on a Android 4.0.3/4 device

I am facing a strange issue. I create a simple PhoenGap app, that loads a HTML website no JavaScript so far. I am able to start the app using a
2.3.3 emulator
4.0.3 emulator
4.1 emulator
or
2.3.3 device
but the app crashes with a "CardovaWebView: TIMEOUT ERROR" in the console and a "Application Error: The connection to the server was unsuccessful. (File://android_asset/www/index.html)" on the screen. This error occurs randomely on all devices.
I am just finding infos about heavy JavaScript things taking too long to trigger the timeout but that's not the case here. Anyone with a hint? Thanks in advance
I just found out: The error occurs only when using GPRS and not using WLAN. So phonegap (or something else) is trying to achieve a connection somewhere... Setting a higher timeout value does not work... Any ideas?
I just found the solution:
Its the weinre debugger. Despite being a useful tool, it's using a hardcoded IP for the importing of the javascript-script like this:
<script src="http://x.x.x.x:8081/target/target-script-min.js"></script>
When using starting the app on a real device using WLAN this poses no problem. But using GPRS it results in the timeout error mentioned above. Hopefully this will save others the time and nerves I lost here.

emulator throwing hostunresolved exception in android?

i have as my first activity in my application a request to a certain address, from where i get XML and then i parse it...
I have added the permission on for internet access in my android.manifest file.
my problem
whenever i run my application on my emulator the following exception is thrown:
05-19 18:25:05.099: WARN/System.err(473): java.net.UnknownHostException: Host is unresolved: www.svgverlag.de:80
i don't understand what is going wrong.
when i open the same address in my browser it opens up fine
i have tried restarting the emulator several times.
i am using a mac.
thank you in advance.
EDIT:
i have tried creating several emulators and in all of them this is happening.Also i tried on my friends macbook pro, and the same thing is happening.
Also in the emulator's browser no webpage is opening.For some reason the emulator is not able to access the internet.
UPDATE
I believe that there is a problem with the emulator on mac per se. No matter what i try:
set the dns in Eclipse Preferences using dns-server- 8.8.8.8
turn of my firewall
nothing seems to make a difference and my emulator is not able to access the internet.
Also there is a 3G symbol at the top of my emulator but with no help regarding internet access.
While on a my windows machine, things seem to work fine without any settings from my side.
what do i do?
Can you try using the IP address of this website instead of using its host name?

Categories

Resources