I made an API between an android application and a desktop application (java). I test that in local between android studio device and my desktop application and it works with local address:
post("http://10.0.2.2:8080/api/v1/locations", json)
but now I want to install the app in my phone so I'm not in local anymore, I want to know which address should I make to post from my phone to my laptop java application?
You need to deploy your service that you have created on some server then you can access same.
so the IP you need to use of server.
Related
I made android app that uses firebase, but as the users live in Syria they should use a VPN to use my app because firebase is blocked in that country.
Is it possible to use a script or a JSON file in my app to workaround this problem?
You should try setting up your own vpn connection inside the app you're developing.
Try using this source to ease out your work.
another solution is that at runtime when your app attempts to connect with internet you can programatically reroute it's root default base connection route to your preferred IP address thus eventually solving your problem without using any external app.
Lastly,You can't try creating a service which will be installed in the backend and when the app is launched the service is automatically triggered with it and hence it will automatically route your connection to preferred vpn IP address.
I has an android apps install in my galaxy tab. This apps will call a web service in the web server which locate in the office. The web service then will call to database in another server. The web server and database server is in same LAN. My web server IP is dynamic which will change every time the modem is restarted and I do not register any domain name. How I can configure my router/modem to let the apps can call the web services which the ip is not statics? Is it possible? Please help.
What is OS of your webserver running ? Windows or Linux? You should configure a static IP for your webserver machine. This way webserver IP 'll not change after modem is restarted. You may find this in Google search
I have built the client using Android and the server using java REST web services.I am able to access the server while running the android code on emulator.However,when I install the .apk file on my mobile and try calling the
REST web service;it does not connect.No communication between the two is initiated.
Check if you are using your public IP address to connect to your server(from client) or not. The URL that you provide in your client should have public IP and not private one.
To determine public/private IPs, please go through the below link
http://www.howtogeek.com/117371/how-to-find-your-computers-private-public-ip-addresses/
I'm running into issues getting my frontend (being built in Android Studio using Java, running through an android device connected via USB) to connect to a locally hosted app-engine backend (running as a local devserver).
Errors are as follows:
Error when attempting to call an API method with:
'apiBld.setRootUrl("http://192.168.0.x:8080/_ah/api/");'
http://pastebin.com/eqHrSLfJ
Error when attempting to call an API method with:
'apiBld.setRootUrl("http://0.0.0.0:8080/_ah/api/");'
http://pastebin.com/s7PMqiyK
-
When its run with '192.168.0.x:8080' the emulated version of the code runs fine, the app connects locally and can call API methods. I've tried suggestions from various other related posts, but nothing has solved my issue. In pom.xml Ive also been sure to enable 0.0.0.0 for the port and we're not yet using authentication.
Any ideas?
It's strange that it connects in the emulator, as the avd network address to tunnel to your computer's loopback is 10.0.2.2.
Make sure the server is running by putting the URL in the browser. You may need to change the port to something else if it is already bound (ie: xbmc web server uses 8080 by default) try 8081. Don't forget the 'httpPort' directive in your build.gradle if using android studio.
I made an android application which connects to a local web service on my desktop computer, in a network with a router.
In AVD, I managed to make calls to the web service, but I have problems when I deploy the application on my android device (connection timeout). The phone was connected to the same network, but the call does not work.
Is there a simple way to make calls to the web service from the device? What are the ways to do this?
make sure that the url you are trying to reach is reachable. For example your computer may be behind a firewall which is not allowed to be accessed from outside the network. You can connect your phone to wireless access point on the same network as your computer.
or you can place the web service on a server that is web accessible.