I have a webservice which is hosted in IIS in windows 8 laptop. I have created an android app which accesses the remote web service and displays the list in fragment which is working fine in android emulator. Now challenge for me is to access the same service from android app when i install it on my android device.
Is network sharing required for this? how to make it if required..
I m using following link in emulator to access webservice
http ://192.168.xxx.xxx/WebService/MainService.svc/GetDataList/0/1
Connect your laptop to the internet and the get IP from there.
Make sure your actual device is connected to the internet as well.
Put the IP you got in the first step as the server address.
Related
I am developing an app for android (with react-native) which is running in android studio emulator. This app should connect to a server, but I am in the testing phase and I run the server in a localhost port. but the localhost of another machine (which is in the same network that I am)
let's say the (local) IP of the other machine is 172.17.240.223 and the port which the server is running on is 8080
when I type 172.17.240.223:8080 in my browser (laptop browser), I get the response and there is no problem. Even when I type this in my browser in the emulator I get the response, but this won't happen in app. why is that?
More generally, it's not possible to customize the URL and how the bundle gets loaded. This flexibility is useful to have.
check issue on github here
in this case ,you can use testflight for IOS testing and for android just create apk.
I am running the cakephp built in server bin/cake server which works fine for making requests through my laptop's browser: localhost:8765/users/get/1.
Yet when I try through my Android emulator to reach 10.0.2.2:8765/users/get/1 it just returns 10.0.2.2 refused to connect.
If I turn off the cakephp server and use MAMP instead I can successfully reach my local server with 10.0.2.2:8888/ionic-backend/users/get/1. So I know my emulator is setup correctly but does anyone know how to connect using cakephp's server? It would be much more convenient.
I am using a Mac, if that helps.
I have a Xamarin Solution with an Android, iOS, and Windows mobile solution. I also have a Web Server that sits on localhost:XXXX.
I need to be able to access the URI endpoints on my local, while debugging on Mobile.
While the Web Server is running I go to fiddler, and compose http://localhost:XXXX/api/Locationsand everything is correct, I get the JSON data and life is good.
However when debugging the App on any phone, I suspect the endpoint on the phone is trying to access it's own "localhost". Is there a hosts file that I can edit on the emulators? or another solution?
If you have WiFi, change localhost to your local IP address and connect phone to that WiFi
i created HTTP adapter for connecting to yahoo weather service and deployed it on worklight server. it works well in worklight simulator and in android emulator but when using it on real android device i am getting following error:
{"invocationContext":null,"errorCode":REQUEST_TIMEOUT","errorMsg":"Request timed out for "http://'192.168.242.1':9080/krishak/apps/services/api/ok/android/query".Make sure the host address is available to the application(especially relevant for Android and iPhone apps)."}
You have to make sure your device can communicate with the Worklight Server where you have deployed your application and adapter. An easy way to test this is to go into the phones mobile browser and attempt to connect to the Worklight console at a location in the form of the following:
http://"server address":"port"/"context root"/console
in your case it looks to be located at:
http://192.168.242.1:9080/krishak/console
If your application cannot connect to the console successfully it is likely your device is not on the correct wifi network in order to establish communication. Please attempt this conenction and provide an update so we can provide further investigation.
I am trying to write a client server application, in which the client is a android device.
I am not confident on socket programming.
I have written a server side application and a client side that runs on my emulator.
Will the same application work between a real android device?
I have edited your question (once its reviewed it will show up). From what I understand, your question is generic. It works on my emulator, will it work on my device.
The answer is yes. The emulator connects to 10.0.2.2 which redirects to 127.0.0.1 on your host machine right ? This is how you would have got it working.
To get it working from a device you will need to do the following
Load your java server on your real ip address on your desktop
Ensure that your desktop is on the internet and the ip address visible to the internet (open)
Ensure that your android phone points to the public ip address of your desktop.
Now, I know your worry :) open ip address. So, you can use a ec2 (free amazon ubuntu instance), install java on it and run your server as java -jar . From eclipse you can export a jar file (runnable jar file) with lib in your jarfilename_lib path.
You can use spring For android via HTTP request.
Here is an example.
When you have static ip in server you should set that static ip in your actual device.If you are running your app on emulator you must set 10.0.0.2.