It is sometimes helpful to have specific information about the user's device. Cordova provides a device object that provides such information.
To retrieve device information, we must install the device plugin with the following command:
cordova plugin add org.apache.cordova.device
To get device information, follow these steps:
Add the following HTML to
index.html
:<div data-role="view" id="app-device" data-title="Contacts" data-layout="layout"> <h3>Device Information</h3> <p> <a data-role="button" data-click="app.demos.device.onFetchInfo"> Fetch Device Info</a> </p> <ul id="device-info" data-role="listview" data-style="inset" style="display: none;"> </ul> </div>
Create a file named
coffee/device.coffee
with the following code:$deviceInfo = $('#device-info') onFetchInfo = -> $deviceInfo.empty() $deviceInfo.append "<li>Name: #{device...