Debugging asp.net service with Android device and Chrome Dev Tools - android

I have setup with VS2012, running an ASP.net web service which talks to an SQL database. I also have an android app being developed (using Cordova, so using javascript) which talks to this web service via ajax.
Everything works fine when I run the javascript on a desktop browser, and most most calls to the web service work fine between the app (loaded onto a phone) and the production server (when I upload the server files there). But there is one service call that doesn't work, and it depends data from Cordova plugins so I have to debug it using the phone and I need to see what's happening at the server end in VS2012 instead of on the production server. I have installed Chrome Dev Tools, and set up port forwarding as described here but can't make the connection; every json call results in "net::ERR_CONNECTION_REFUSED" in the Chrome console. I have tried turning off the firewall on the PC (Windows 7) but no effect.
This must be a common requirement and it seems from the Chrome Dev page that it is all straightforward so what am I doing wrong?

Related

How to get React Native APP running on Android Emulator to reach local api

I am running a React Native app that was configured using Android Studio on Windows 10. This app runs in an emulator. Normally I use a combo of npm start and npm run android:dev in 2 separate terminals to start the app.
I have an asp.net api as well that is running on http://localhost:5000 on my computer.
My computer's local IP is 192.168.0.84.
My react native app does not/cannot seem to reach my API at all.
I ran fiddler to capture Http/Https traffic locally and I never see a network request.
Though I can see google maps requests come in from the emulator when I go to the settings screen.
I have tried setting my react native app's API URL to http://localhost:5000, this does not work and gets a rejected promise when network requests are made.
I have tried setting my react native app's API URL to http://192.168.084:5000 this also does not work but no errors are generated.
API urls for other environments such as dev or qa that use FQDN work as expected.
What specifically do I need to do to get this working locally?
Are there specific proxy settings on the emulator I need to configure on this screen?
Are there port forwarding settings I need to do with ADB?

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 connect to local host of another machine with android emulator

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.

WebSocket connection from Unity app

I'm writing app that connects to a custom websocket server (socket.io) written in NodeJS.
This server also handles requests from a browser and the browser part works flawlessly, connection, disconnection, messages, all great.
The app part works perfect on Android (tested on samsung s7) and iOS (tested on iPhone6 and 7 with iOS11.3)
Problem is that I need to get it working on headsets like Nibiru and PicoVR, which operative systems are derived from Android (they're a VR version of Android), on these systems, the app works fine, but can't connect to the webserver.
Additional info:
Server runs on port 7000
Server also has apache, php and mysql installed
HTTP connection to server works
The URL I use for the socket is: "http://192.168.12.1:7000" (server is local, running on port 7000 bc port 80 is taken by apache)
I'm developing all the apps with Unity3d, version 2017.2.0f3
Plugin used for WebSockets: Socket.IO-Unity
Solved the issue by changing the scripting runtime version from "Stable 3.5" to "Experimental 4.6"

Remotely debugging service worker on chrome android with self signed certificate

I was trying to debug a service worker served from my dev machine and running inside chrome android on the smartphone.
I was using the usb connection and remotely debugging from my dev machine. The service worker works only in https and I can live with that, both chrome and firefox where refusing to register the SW.
Then I used a self signed certificate on my dev machine, which obviously was not trusted by the mobile browsers. They warned the certificate was not good but gave the option to proceed with that certificate. I clicked yes and, while firefox from that point was able to register the SW chrome was still compaining that the certificate was not good and refused to register the SW.
I tried to include the self signed CA in the smartphone trust list but didn't find a way to do that. In the end I had to serve the app from a production server with a regular certificate, which I didn't like at all, but I could not waste a whole day on this issue.
How is it possible to remote debug a service worker on android served from a dev machine in a LAN? localhost cannot be used because they are 2 separate devices. I found a setting to ignore the https waring for chrome but desktop version, I am using android chrome, how can I disable this boring blocking error?
Thanks
I was also facing same issue. I have written service worker for push notification for my personal use. It was running perfectly on my desktop browser as I was running it on localhost. But I wanted notification on mobile so I tried many options to accomplish same, Running remote IP as localhost on mobile, USB debugging, adding ssl certificates and many other hacks but nothing worked for me. But then "Kick Web Server" app for android mobile came to my rescue, It took only few minute to run my application on mobile browser with localhost and register service worker. So no need of SSL and USB debugging any more.
Steps
Goto playstore and search for "Kick Web Server" app (Note: after serching results will show "Web Server PHPMyAdmin/MySql" with icon like this).
Do not afraid you do not need PHP or Mysql with this app, you can run your web site with ease written in any technology stack.
Open app it will ask you for permission to access storage, you have to grant permission to it.
Get back to app and click on stopped button to start web server.
It will create directory/folder named htdocs in your mobile storage.
Delete existing content(two existing files) from htdocs directory.
Copy content of your build with index.html in htdocs directory.
Visit http://localhost:8080 in your mobile browser and you will see your site is up and running with service worker registered.

Categories

Resources