Running an android app on phone - android

I have a Cordova project in spring-rest for server side and client side i am using commandline tool for client side building.On client side AVD runs and is able to access my server side code. I want to test the same app on my android phone.
I have enabled USB Debugging on my phone and i am on same network as my computer..i am able to see the app installed but its not accessing the server side code on my eclipse and fetching the results.
please help me out.
Thanks.

Related

Unable to connect to Node JS localhost API from android app in emulator

I run Node JS on localhost. Trying to call one of the Node API http://10.0.2.2:8000/api_users from android app running in the emulator. FileNotFound exception or FailedToConnect exception is what I end up with.
Am I doing anything wrong? Is there another way to connect to the NodeJS API running locally?
Kindly help. Thanks in Advance.
Right now, your API isn’t working, because Android EMULATES a phone, having their own local, on the phone, but not linked at all from your phone to your computer, that’s why there is no access to your API via localhost. Right now, the emulator tries to access the localhost from the phone. You can solve that by using a local IP Adress

debugging the android application in Visual Studio Xamarin to see the response from web api

Debug in Xamarin Visual Studio
How to debug the android application in Visual Studio Xamarin to see the response from web api? I am using Xamarin Visual Studio, ad making some http web api calls. the application is showing some random value which is not exactly the expected response from web api. In android studio it is possible to debug and figure out where the problem is. my question is, can we as well debug in Xamarin Visual studio. because when I put the debugger points the application doesn't just stop at the debugger, and I can not figure what exactly the problem is.
I would recommend installing Fiddler. Once you have that installed, fire it up and configure it to proxy as per the default configuration.
Then in your Android device or emulator configure the Wi-Fi to point at Fiddler on port 8888.
Once you have done this you will be able to see all the requests and responses in the Fiddler UI. The steps to perform this on the device or emulator are:
Swipe down from the top of the screen and tap the Settings icon.
Tap Wi-Fi.
Tap and hold your current Wi-Fi network. Select Modify Network
Tap the Show advanced options box.
Tap the Proxy settings dropdown and select Manual.
Type the IP address and port (usually 8888) of the Fiddler server.
Tap Save.
To verify this configuration, go to http://ipv4.fiddler:8888/. You should see the Fiddler Echo Service webpage, and the traffic should appear in Fiddler.

Ionic can't run my app from the device browser

I am developing an Android app using ionic. When I execute ionic serve I can see my app on my computer through http://localhost:8100
I checked my ip address using ipconfig and it's 192.168.0.3, so I tried using this IP from my device (http://192.168.0.3:8100), but I got a 404. I then tried from the very same computer I am developing from, and I got a 404 too!
Funny thing is, ionic uses two servers:
If I put http://192.168.0.3:35729 I can see live reload server both from my computer and my device. I didn't have to touch anything on my router to forward ports, and both my computer and my phone are on the same network. Note that I cannot access http://192.168.0.3:8100 neither from my phone nor from my computer (the same one I am using to develop)
Also I am serving a REST web service on 8080 from a J2EE app, and I can see it in my device. My app consumes this service, and from the computer, everything works fine. But from the device, although I can use the phone browser to access the REST server, my ionic app gives me another 404 error!
Can anyone point me in the right direction?
You will have to change the address Ionic has configured. Run:
ionic address
Then it will provide you a list of available addresses:
Multiple addresses available.
Please select which address to use by entering its number from the list below:
1) 192.168.0.107 (eth1)
2) localhost
Select your local IP from the available options. This must solve the issue you're facing.

Google App Engine, gradle, open port

I'm developing an android app with Google app engine endpoint using Android Studio.
Is it possible to make the local app engine server open the port it is running on? I'm trying to debug an android application with a phone that is in the same LAN as my app engine server but I can't do that because the ports doesn't open.
Meaning, while I'm able to reach the server program at localhost:8080 from the server computer, I'm not able to reach it from my phone at {server_ip}:8080.
Now I'm sure I am not having problems with port-forwarding in my router, since
when I take the generated war-file and deploy it to a tomcat server, I'm able to reach the server from my phone. But then I will not be able to do a step-by-step debugging in Android Studio.
Thanks NNJ,
After reading that post (https://stackoverflow.com/a/21776775), I understood that I should include httpAddress = '0.0.0.0' in my build.gradle for the server module and now I'm able to reach the endpoints from outside the server.

How to access computer's local host on Android phone?

I'm currently using Android Studio to prototype an Android application. I'm trying to use the Google App Engine Servlet Module to write a prototype backend for my app. I can run the dev server and access the page via localhost:8080. However, I cannot access this address on my physical android phone over the same wifi connection.
I understand that I cannot use the term localhost within the Android's web browser because that does not refer to the computer's instance of localhost. I tried looking up my computer's ipv4 address and using the "ipaddress:8080" to access the page on the phone, but that does not seem to work either for the Servlet Module within Android Studio.
I have an older server application running on Apache Tomcat within Eclipse. When I run that, I am able to utilize the "ipaddress:8080" method to access the page on my android device.
Any ideas as to why this works while the Android Studio Google App Engine Servlet Module dev server fails? Any suggestions as how to resolve this issue would be greatly appreciated!
You can access the localhost in the following way : 10.0.2.2:8080
I realized that the server did not bind to my IP address. I changed configuration settings within Android Studio for my server to use http address "0.0.0.0". It now works.
In my case, I was receiving null for list request after deploying backend (running on Android device). For some reason backend received requests and didn't respond. The fix for me was to re-deploy and create new project, syncing with my android project front-end code. Then as a result my front end was connected to the back-end exactly as described here: https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints step 2.3, and two additional fields were generated in my JSON: "kind" and "etag"

Categories

Resources