Skip to content Skip to sidebar Skip to footer

Mobile Phonegap Applications On A Local Network

I've created a game using html5 and websockets that is played with both a pc and a mobile device (multiple mobile devices can also be played): The game has a Stage - The PC or a ta

Solution 1:

You can try this cordova-plugin-networkinterface plugin that supports Android, Blackberry 10, iOS and Windows devices.

Solution 2:

There's no javascript only way to the local ip address from inside a browser. There do seem to be a good number of cordova/phonegap plugins that purport to do this:

http://plugreg.com/plugin/weconstudio-it/phonegap-plugin-ipaddresshttps://github.com/jcesarmobile/my-phonegap-plugins/tree/master/iOS/NetworkInterfacesPlugin

As well as the one pointed out in the comment above. It looks like it's either android or IOS. Someone should write one that works on both!

If it was me. I would probably work with the browser headers on the Stage: REMOTE_ADDR, HTTP_CLIENT_IP, etc. There are some fine points to doing this: http://roshanbh.com.np/2007/12/getting-real-ip-address-in-php.html

On a local network, you'll be able to get the real IP address of each device. Private networks fall into a particular address space:

10.0.0.0        -   10.255.255.255
172.16.0.0      -   172.31.255.255
192.168.0.0     -   192.168.255.255

So your Stage will know when its clients are connecting to it on a LAN. Does that get you where you need to go?

Post a Comment for "Mobile Phonegap Applications On A Local Network"