ch.rts.cordova.is.tablet
v1.1.0
Published
IsTablet Cordova/Phonegap Plugin =================================
Downloads
22
Readme
IsTablet Cordova/Phonegap Plugin
fork of https://github.com/nightstomp/phonegap-istablet
This Cordova/PhoneGap Plugin indicates whether the current Android or iOS device is a tablet.
The plugin is registered on npm as ch.rts.cordova.is.tablet
Contents
Installation
Using the Cordova CLI
$ cordova plugin add ch.rts.cordova.is.tablet
NOTE: Make sure your Cordova CLI version is 5.0.0+ (check with cordova -v
). Cordova 4.x and below uses the now deprecated Cordova Plugin Registry as its plugin repository, so using a version of Cordova 4.x or below will result in installing an old version of this plugin.
Using the plugin
The plugin runs automatically when the app starts and sets an isTablet
boolean property on the window
object, so to use the plugin, simple inspect the value of window.isTablet
.
For example:
alert("This device is "+(window.isTablet?'':'NOT')+" a tablet");
Example project
https://github.com/dpa99c/phonegap-istablet-example
The above link is to an example Cordova project which demonstrates usage of this plugin. The example contains Android and iOS projects, and a compiled Android APK.
Credits
Android plugin code based on this answer on stackoverflow by Pawan M
License
The MIT License
Copyright (c) 2014 Working Edge Ltd.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.