Codenameone How to detect if device in on wifi or cellular? - codenameone

How can I detect if device is connected to wifi or cellular network ?
I need to warn users of large uploads when they are not on wifi.

Check out the Connectivity cn1lib in the extension manager. It's available here as well: https://github.com/littlemonkeyltd/codenameone-connectivity

Related

Rendering localhost react app on mobile phone

I have been trying to render localhost:3000 (React app) on my phone. I have tried the following,
Connecting my MacBook and the phone to the same wifi, getting the ipv4 address and adding port 3000 to it and accessing that IP address port combination in my phone.
I have tried turning off my firewall.
I also tried npm start --host 0.0.0.0
I am running localhost on my MacBook. My colleague who has a Windows machine is also facing similar issues.
Make sure that the wifi network's wireless settings do not prevent local clients from connecting to each other. There is a setting often called "Wireless Isolation" which is pretty common - enabling this results in clients only being able to connect to the outside internet, but not to anything else (such as other wifi clients) on the network. While this is useful from a security perspective when the network administrator doesn't know whether the devices that want to connect are trustworthy, it blocks network functionality. Go into the router's settings and turn this off if it's on.

How to distinguish whether a hotspot is from a mobile device or a wifi router?

I scan and get a wifi list(BSSID,SSID,RSSI,SECURITY...). Is there any information can help to distinguish whether a hotspot is from a mobile device or a wifi router without connecting to it?

Is it possible to make a Captive Portal from the windows Wi-Fi hotspot?

I was wandering if the Wi-Fi of the computers Hotspot can be turned into a Captive Portal. I want to create a Wi-Fi hotspot from the Computer and when someone connects to the Wi-Fi it should redirect to a specific webpage on the LAN on opening their browser. I am using XAMPP server to host all my files.
I can connect to the page but I need to type the IP Address every time from all devices I connect. Usually this feature is given on some routers but I want to find out if it possible using Computer as Wi-Fi Hotspot.
I know there are some software's which can do this on windows, but I want to know if it is possible using windows commands/BAT/VBS/PowerShell!

Ionic framework - detect internet connection

I am developing simple application using Ionic framework (and AngularJs) that fetches json data from my webpage. How can I detect is there "internet connection" and display message to user: "Connect to internet" if not.
EDIT
Can I use cordova API for that ?
Cordova provides org.apache.cordova.network-information plugin.
See documentation HERE
This plugin provides an implementation of an old version of the Network Information API. It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
If I am not mistaken, this plugin only detects whether the Wi-Fi or Cellular networking is enabled on the device. This does not always mean that the application can actually reach your remote server, if you are connected to the WiFi network without internet connection.
Therefore, the only solution I have found to ensure that the application can reach your remote server is to continuously ping the server.

Connecting to device behind firewall

I have a wpf app that needs to communicate(exchange data) with a custom designed device (we can modify the code for the device). Do I have any options to connect to the device if it is behind a firewall via http? I was hoping there would be a method where the admin would not have to forward any specific ports or do anything on his end. I assume the issue is how would I address the device from my app. I know SOAP over SMTP is one option. Is another option where the device could chatter out to my application via http?
This problem is solved by relay services like Yaler or My-devices (I did not test this last one).
UPNP is supported by some firewalls to simplify this. Otherwise you are usually stuck opening ports on the firewall manually or using some 3rd party proxy server for a rendezvous server.
A lot of firewalls are setup to allow access on port 80 (HTTP) otherwise the users wouldn't be able to browse web sites on the internet. You can try and see if port 80 is open to traffic. If you can modify the code for both the device and the client you can use port 80 to communicate with your own protocol - you don't necessarily need to use HTTP.
Any kind of RESTful architecture over http will do it. If this is the best option for you depends on what APIs / libraries are available on your custom device.

Resources