POST JSON without Internet with Genymotion - android

I have local database and Android app in Genymotion. I want to send POST JSON without internet. Both sides of code is ok on USB Device and database with WIFI connection. My database is written on ASP.Net web api 2 with azure functions.I tried to use different URL's
http://198.168.67.2:7071/api/LogIn
http://10.0.3.2:7071/api/LogIn
http://10.0.3.15:7071/api/LogIn
and nothing happened.
So, my question is: Can I send POST without internet using Genymotion and if yes how can I do this.
Thanks for help.

In order to do that, you'll need to connect the both desktop and your Android device (such as emulator or a real device) to a network which has a router.
Router will do the rest and it does not matter if it has internet connection or not.
So the solution will be that connecting both Desktop and the Android device to a local network which they can find the eachother.
Remember to add the Internet permission in the AndroidManifest.xml.
Check this link for more information.
This one.
And this one too.

Related

Android server can't be reached from device

I am trying to access some php files that get data out of a local database.
The url is http://192.168.x.x/Foodlogging/getUserFromDB.php.
This worked perfectly in the emulator when I used 10.0.2.2.
I can access this url from my browser on my computer itself but not from the browser on the device.
I have this inside my manifest: <uses-permission android:name="android.permission.INTERNET"/>.
Both the devices are on the same network.
Any idea what I might be doing wrong?
P.S.: I am on my schools network and I know they have very strict firewall rules/settings, so might that be the problem? Like 1/100 I can access the url, the other times I can't.
Try turning off the mobile internet on the android phone, and leave Wifi on only.
This caused some issues for me when accessing local lan servers (usually 192.168.x.x).

Access local network from app while phone is acting as WiFi hotspot?

I'm writing an app that needs to be able to access the web server on my laptop. The phone I'm developing on is acting as a WiFi hotspot which my laptop is connected to. Everything is working fine if I try to access 192.168.43.16 in the phone's browser.
But the app I'm developing is not able to access the webserver for some reason. I'm guessing it's trying to use the 3G connection instead, which of course will not work. If I turn off mobile data I get an error message in my app saying that it can't connect to 172.30.253.241:8799, which seems to be my ISP's MMS server (?). That makes no sense to me, but maybe there's some caching going on here? Again, accessing my local webserver with Chrome in the phone works perfectly fine.
The app is using the "Android Asynchronous Http Client" by loopj, which is built on top of Apache's HttpClient. What can I do to make this work?
The reason I want to be able to access the local webserver is because it makes developing and debugging the server api used with my app a lot easier and faster than FTP-ing to my production server on the web.
Problem solved!
What I had to do was set the proxy of the AsyncHttpClient, using setProxy(), before making the request. I set the proxy address to the local IP address of my laptop running the web server.
client.setProxy("192.168.43.16", 80);
Now it seems to be working as expected.

Testing the server side code before deploying

I need to send an image file from the mobile to the server(where the server will save it to the hard disk). I have wrote both the android mobile part and the server side. I need to test the code before deploying to the server. Will the code work if I connect the mobile to the WI-Fi network through which I can have a LAN connection to the system? Is there any way I can test the code with out using a WI-Fi connection(ie Connecting phone to the system via the usb cable and then forming a LAN or something)? Please voice your valuable opinion in these stuff.
When I was testing my server-side I didn't find any other way rather than connecting via wifi, this way it was working just fine (in your code you need to use ipv4, not localhost, just as reminder). I'm not good with network stuff, but I don't think it's possible using usb to create some kind of LAN.
Have u tried from emulator? How to connect to my http://localhost web server from Android Emulator in Eclipse

Connection with Wi Fi in android device

I am facing a strange problem with my Android ACE phone. I am able to connect to Wi-Fi and able to browse Google. But unable to connect to my Internal Servers / network. What is the problem? Will it be an issue with the device or is it the problem with router? Same Server is accessible through my IPAD2!!
My client is telling me that they have not blocked my device from accessing their network.. But my device displays "DNS Error" when i try hitting their server.
So is there any way that I can detect if my user agent or device is blocked by the internal router or network??
Thanks in advance,
Sneha
First of all this is not the place to ask this type of questions. This site is for development/programming related questions. Why don't you use https://android.stackexchange.com/. However I think your issue can be fixed by using custom DNS servers like 8.8.8.8 or 8.8.8.4. Or you could run a port scan on your network and see if they have a DNS server.

How do I get my Android app to communicate with the server over a VPN?

I have an android application that talks to a server app running on grails (Groovy on Grails).
Android app basically establishes a connection with this address:
url="http://192.168.2.53:8080/tma/majBtm/androidToDesktop";
It all works fine when both the server and the android phone are connected in the same lan network.
Now the problem arises when I want the phone to talk to the server while the phone is outside the local network (I need it to use edge).
I came across VPN networks which I think might help me out. (the server has dynamic IP)
So what i did was go to dyndns.com and created a new hostname and have the app successfully run on the server. The host I created was - tmagrails.dyndns.com
How do I make my phone connect to this network? What changes am I supposed to make in order to get things working?
Also, I really want to know if this is the right approach. If not, is there any way to get things going for me?
Please advice.
First you need to set up port forwarding so that port 8080 is forwarded to your 192.168.2.53 ip address. A google search on your router model should tell you how to do this. If you want to make your app more secure you will also need to look at SSL and TLS While this won't garantee your app is secure it will stop the network traffic to your app being easily read if you were to access it from an open wifi hotspot.

Categories

Resources