AppVeyor | Travis CI |
---|
This plugin provides an implementation of an old version of theNetwork Information API.It provides information about the device's cellular andwifi connection, and whether the device has an internet connection.
The older licenses (you can also move them to another folder until the Creo 4.0 is installed). After the folder is empty you can proceed with the next step. Please note that ProgramData folder is a hidden folder. The easy way to access this location is to simply copy C: ProgramData PTC Licensing and paste it in the Windows explorer. Running the NVT—NetWorker Validation Tool – Runs on a live network and provides information about network connectivity between the NetWorker server and its clients. NSRPCHK—NetWorker Proactive Check Tool – Probes the NetWorker Server database for information.
To get a few ideas how to use the plugin, check out the sample at the bottom of this page or go straight to the reference content.
Installation
Supported Platforms
- Android
- Browser
- iOS
- Windows
The
connection
object, exposed via navigator.connection
, provides information about the device's cellular and wifi connection.Properties
- connection.type
Constants
- Connection.UNKNOWN
- Connection.ETHERNET
- Connection.WIFI
- Connection.CELL_2G
- Connection.CELL_3G
- Connection.CELL_4G
- Connection.CELL
- Connection.NONE
connection.type
This property offers a fast way to determine the device's networkconnection state, and type of connection.
Quick Example
API Change
Until Cordova 2.3.0, the
Connection
object was accessed vianavigator.network.connection
, after which it was changed tonavigator.connection
to match the W3C specification. It's stillavailable at its original location, but is deprecated and willeventually be removed.iOS Quirks
- <iOS7 can't detect the type of cellular network connection.
navigator.connection.type
is set toConnection.CELL
for all cellular data.
Windows Quirks
- When running in the Phone 8.1 emulator, always detects
navigator.connection.type
asConnection.ETHERNET
.
Browser Quirks
- Browser can't detect the type of network connection.
navigator.connection.type
is always set toConnection.UNKNOWN
when online.
offline
The event fires when an application goes offline, and the device isnot connected to the Internet.
Details
The
offline
event fires when a previously connected device loses anetwork connection so that an application can no longer access theInternet. It relies on the same information as the Connection API,and fires when the value of connection.type
becomes NONE
.Applications typically should use
document.addEventListener
toattach an event listener once the deviceready
event fires.Quick Example
iOS Quirks
During initial startup, the first offline event (if applicable) takes at least a second to fire.
online
This event fires when an application goes online, and the devicebecomes connected to the Internet.
Details
The
online
event fires when a previously unconnected device receivesa network connection to allow an application access to the Internet.It relies on the same information as the Connection API,and fires when the connection.type
changes from NONE
to any othervalue.Applications typically should use
document.addEventListener
toattach an event listener once the deviceready
event fires.Quick Example
iOS Quirks
During initial startup, the first
online
event (if applicable) takesat least a second to fire, prior to which connection.type
isUNKNOWN
.Sample: Upload a File Depending on your Network State
Networker Network Info App 4 4 0 7
The code examples in this section show examples of changing app behavior using the online and offline events and your network connection status.
To start with, create a new FileEntry object (data.txt) to use for sample data. Call this function from the
deviceready
handler.Note This code example requires the File plugin.
Next, add listeners for the online and offline events in the
deviceready
handler.The app's
onOnline
function handles the online event. In the event handler, check the current network state. In this app, treat any connection type as good except Connection.NONE. If you have a connection, you try to upload a file.When the online event fires in the preceding code, call the app's
tryToUploadFile
function.If the FileTransfer object's upload function fails, call the app's
offlineWrite
function to save the current data somewhere.Networker Network Info App 4 4 0 8
Note This example requires the FileTransfer plugin.
Here is the code for the
offlineWrite
function.Firestream v1 22 download free. Note This code examples requires the File plugin.
If the offline event occurs, just do something like notify the user (for this example, just log it).