Debugging an App, that needs a URL to a server - android

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

Related

Debugging HTTPS local services from my mobile device (web, api, websocket)

Having a hard time debugging from mobile device my local development web app which connects to a GraphQL node server and another service using web sockets. All three services running on HTTPS to the below ports.
Web Reactjs app: https://localhost:3335
Node server: https://localhost:3334
Web socket server: wss://localhost:4443
From my macOS machine, everything works as expected but when trying to access the reactjs from Chrome Android and using the inspect desktop devtools and USB cable navigating to https://localhost:3335 works but I get the error POST https://localhost:3334/dev/graphql net::ERR_CERT_DATE_INVALID.
My iOS device doesn't even connect to localhost:3335 or 192.168.2.3:3335.
I am open to any tips, tricks, services, and ideas to debug using my local development machine and mobile devices.
I was able to make it work by navigating to all addresses in the mobile browser and accept the risk of a self-signed certificate.
https://localhost:3334/dev/grapqhl -> accept
https://localhost:4443 -> accept
Now https://localhost:3335 will work fine.
Struggling with iPhone debugging due to localhost not binding to the machine IP address (Pending solution, might create another SO question for reference).

How to access NodeJS from another network

I have a NodeJS server that I'm currently working on in my machine. The OS is Windows 10.
I'm part of a small team of two and we are currently in a stage of development where i'm branching out to android app development and the other guy is making additional changes to the NodeJS server.
Thing is, when we gather and use the same network, I can successfully connect to the server being hosted in another computer via the app by using target computer's IP_address:port when making the HTTP request, but when we are "home-office-ing" we can't seem to be able to see or connect to the server being hosted in each other's machines.
Even by using the http://192.168.0.x:port ,address which works when we are connected in the same network, we can't access and get ERR_CONNECTION_TIMED_OUT when in different networks.
The port we are using to open the server is port 80, but we tried with port 3000 and forwarded it on the router, and still, it doesn't work
Is there a way to open up the server so it can be seen by a computer in an outside network?(I know that it will also be available for any other computer to see and interact with the server)
You have to use public IP address.
The most easiest solution is to rent a VPS with public IP address.
Just Google 'rent vps server' to find any hosting provider.

Access Java Web application running on a server by Android device thru wifi

I have searched for a solution to this but could not find one. If this is already answered, sorry, please direct me to that.
My problem is this. I have java web application running on a local intranet (Tomcat 7, Java 6, MySQL). All desktops within the intranet are connected thru LAN and access the application using the specific server IP, something like 198.162.2.10.
Now, I want to access this thru my android mobile phone as well. The entire building is Wifi enabled and I'm able to access this web application, if I know the IP and enter it in the mobile browser. But, I would like to make this mobile access automatic and wrap it in an app which on click access this automatically, even when the IP changes. We have dynamic IPs.
You can use WebView component to display a web page within your application.
As alternative you can use HttpURLConnection co perform Http request and posts to your web application.
Regarding the dynamic IP you can configure a Local dns server or assign a static IP to the server.
Anyway the application need a fixed address to connect to the web application, unless you want to insert the address manually each time.

Syncing between a local network and Android application

I am in need of some help here.
I want to make an Android application that eventually syncs to a web server in order to get information (i.e. user can write a note through the website, and it automatically syncs to the phone).
I am aware that I would need some web servers and hosting, and don't know too much about that so I will look into it later.
MY question, however, is how I can simulate this over a local network?
As in, if I create a basic webpage that has a two text boxes (one for name, one for content) and a 'submit' button, if I run it via localhost WHAT methods can I use to get this information to sync to my handset?
If anyone could be kind enough to give me a laymens terms breakdown it would be seriously appreciated, I feel so lost!
You have some alternatives to achieve what you want, here is a traditional one:
Start with installing XAMPP and run a local server
Write your web pages, store the data in mysql
Write PHP code to extract the data from mysql
Use Android HttpClient to call your PHP
There are other alternatives:
Use the same method but instead of PHP write HTML5 and you have a mobile WEB application
Check out the GCM Demo Application
Check out Google App Engine
Check out Amazon Web Services
There are others
Enjoy :)
Yaron
When you use localhost (meaning you install a server package such as Apache / IIS / XAMPP / WAMP in your computer), your machine becomes a server. So, you can access the localhost from any device which is in the same network.
Say you have a computer connected to a WiFi router. If you setup the server i.e. the localhost in that computer and a laptop and a mobile phone is connected to the same WiFi router, the phone and laptop will be able to get service from the computer.
To access data stored in the MySQL server from the other devices (e.g. the phone), you have to write proper service. Else, you can write a mobile web app in the server that accesses the MySQL data and just access it from the device.

Android Get Base URL of HTML app

I have an app that is running on my phone that is simply displaying a web page. I'm trying to get the website name/info so that I can browse this on my desktop. I used Packet Sniffer to get the IP address but there are multiple hosts running on this IP. What's the best way for me to get the real URL/hostnames used by an Android app?
FYI: I've decoded the app but I still haven't figured out what the URL is.
What I would do is, install the app in the emulator, and then use wireshark, which can handle http traffic.

Categories

Resources