Book Image

JavaScript Mobile Application Development

Book Image

JavaScript Mobile Application Development

Overview of this book

Table of Contents (15 chapters)
JavaScript Mobile Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Connection


The connection plugin provides information about the connection type of the device. In order to use the connection plugin in our Apache Cordova project, we need to use the following cordova plugin add command:

> cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git

Demo

In order to access the connection demo, you can click on the Connection list item. You will be introduced to the Connection page. You can click on the Get Connection Type button in order to know the current connection type of your device, as shown in the following screenshot:

Getting the device's connection type

The HTML page

The following code snippet shows the "connection" page:

<div data-role="page" id="connection">
    <div data-role="header">
        <h1>Connection</h1>
        <a href="#" data-role="button" data-rel="back" data-icon="back">Back</a>
    </div>
    <div data-role="content">
        <h1>Welcome to...