Binding to cordova-plugin-network-information.
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.
Source: cordova-plugin-network-information
Only gen_js_api version is developed.
Don't forget to switch to a compiler >= 4.03.0.
opam switch 4.03.0
You can use opam by pinning the repository with
opam pin add cordova-plugin-network-information https://github.com/dannywillems/ocaml-cordova-plugin-network-information.git
and to compile your project, use
ocamlfind ocamlc -c -o [output_file] -package gen_js_api -package cordova-plugin-network-information [...] -linkpkg [other arguments]
Don't forget to install the cordova plugin network information with
cordova plugin add cordova-plugin-network-information
You can access to the connection type using Cordova_network_information.current () (the unit parameter is mandatory because NetworkInformation javascript object is initialised when the device ready event is launched).
It returns a value of type Cordova_network_information.connection and you can get the string representation with Cordova_network_information.connect_to_str function.
- Event listener