can a PhoneGap app access localhost upon being installed on device? - node.js

I developed a test mobile app with PhoneJS, which access a node server ( localhost:3000) w MongoDB local DB...
Everything is working fine when testing in web browser or using Ripple simulator.
Then I deployed this test app using PhoneGap/Cordova ( 3.0.0 ) and installed it on my iPhone device.
Starting the app, the data are not loaded ( got the Loading icon... and nothing happen)
As my node server doesn't display anything in the console, I guess there is an issue in the .get Ajax call
is there any specific parameter to be added to the PhoneGap config.xml ?
( I have already : github.com/erwin/DataBound.Mobile.git included ..

Localhost is "this computer" so when you try to access localhost from your phone you don't get an answer because you don't have a server in your phone.
You have to use the local IP of the computer with the server instead using localhost if the server and the phone are on the same network

Related

Call node api from mobile phone while developing flutter app

I am developing a chat application. I connect my mobile phone for testing/debugging while developing. But I can't call backend node API from my mobile phone and have to use an emulator to do so and the emulator works very slow on my laptop. Is there any way I could call the API from my connected mobile itself while developing?
static const BaseUrl = "http://10.0.2.2:3000/";
I also tried by giving ip address wherein both pc and my mobile phone are in the same network as below-
static const BaseUrl = "http://ipv4 address:8000/";
Is there any way I can test my app while developing through connected mobile phone and call backend node api?
Go into your Command Prompt or whatever console you have. I am using windows, so I would open up the CMD and type in IPconfig. Go to where you see "IPv4 Address", and copy the numbers that you see there. THAT will be what you will need to use in order to get access to your server. Make sure that your phone and computer(or whatever you are running the server on) is on the same WIFI, or else this will not work.

Call an API from web browser to the localhost of Electron app via WebSocket

I've made an Electron application as a server to receive API requests on the user's PC. Then I've allowed users to request API from the browser (not only on the same PC) to Electron application localhost server. To make it work, I've used Ngrok as a tunnel to publish my local port, but because of the limitation for free users, I could not use it anymore.
I'm aiming to solution calling localhost via Web Socket, but I could not found anyone attempted on the Internet.
Could you please give me some idea to deal with it? Thanks in advance.

vuetify project with express.js backend run in mobile network but unable to do backend processes

I have a project that I built using vuetify for frontend and node with express.js for backend, the project works perfectly in my computer,
and also works in my phone when I access it using the ip giving by vuetify which is http://192.168.1.2:8080/ but when i try to login,
it seems like it does not get the backend server which is running on http://localhost:5000.
It does not give error or success it just does nothing.
this is vuetify cli
this is node server.js running in port 5000
this is my login page in my computer which works fine
this is my login page in my phone which does not work

Access local nodejs server from google spreadsheets

Currently, I have a google app script backend connected to a spreadsheet.
This app script backend does REST api calls to my website hosted at https://example.com/example and everything works fine.
The issue is, to do testing I have to make changes to local code, deploy and only then test if everything is working in order or not at the remote server "example.com"
When I try and change the site to https://localhost/example (with nodejs server running locally) it fails with a bad hostname/dns server not found issue.
How can I work with spreadsheets/app script so that i can work with my local nodejs server ? Is it possible ?
use ngrok , Checkout the npm package here https://www.npmjs.com/package/ngrok, or
you can directly download and use it, check here.
ngrok secure introspectable tunnels to localhost webhook development
tool and debugging tool.
Edit:
In my case, I had to
Download ngrok on my windows machine via the ngrok website
Connect account:ngrok authtoken <tokenid>
Run ngrok on my machine like this: ngrok http https://localhost:port
Connect via the public ip at https://<somename>.ngrok.io, where "somename" is a unique id which is created by ngrok.

Whitelisted chromecast works with default tictactoe app ID but not mine

I am trying to get the tic tac toe demo from github working on my Chromecast after changing only the app id of the clients. With the default app id, I have been able to launch and play the game with an android client and a mac client.
I have:
Added my Chromecast device on the developer console (it has a green status indicator)
Set (via the Android Chromecast app) the Chromecast to send the device serial number
Verified that the serial number is correct
Verified with both the Android and Windows Chromecast apps that the serial# setting is retained
Power cycled the Chromecast
Setup an app id in the developer console (status is a grey circle labeled 'Unpublished')
Entered an internet accessible (not local) URL for the app id
Installed the receiver app at the above url and verified I can access it from a browser on the same network as the Chromecast
Also tried a local IP address (192.168.x.x) which I understand is supported as well
Modified the web client ttt.js file to use my app id (and verified app id is correct)
Modified the android client (GameActivity.java) to use my app id (and verified app id)
Did a git diff to make sure that I didn't inadvertently change anything else
Verified that my local copy of the source is the latest from git
When running the android client I can connect to my Chromecast but the Chromecast home screen shows "Brain Freeze", "We're sorry, but something could not load", "Activity aborted".
The logcat console in eclipse for the android device reports, "ConnectionResultCallback. Unable to launch the game. statusCode: 2002".
The web client on the Mac results in the same messages on the Chromecast and
'"reason":"CANCELLED","type":"LAUNCH_ERROR"'
on the web page output.
Is there a way to get more information from the Chromecast to indicate what is going wrong with the launch?
Follow Up
It turns out that the issue was in my network setup and not in my chromecast setup. After sniffing the network traffic with wireshark, I could see that the ARP request to retrieve the MAC address of my server was not getting a response. I am running my server on Virtualbox with a bridged adapter but needed to turn on promiscuous mode (allow all). Now the chromecast successfully launches the receiver app and I can play the tic tac toe game when using an HTTP based URL. (I need to fix the certificate for HTTPS).
Thanks Les, for the effort.
Did you verify that [x] send my serial # to Google has been checked (using the setup app)?
Also, did you wait 15 minutes and then restart your device (power cycle)?

Resources