How to use cordova-plugin-device - 4 common examples

To help you get started, we’ve selected a few cordova-plugin-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phonegap / phonegap-mobile-accessibility / www / mobile-accessibility.js View on Github external
MobileAccessibility.prototype.injectLocalAndroidVoxScript = function() {
    var versionsplit = device.version.split('.');
    if (device.platform !== "Android" ||
        !(versionsplit[0] > 4 || (versionsplit[0] == 4 && versionsplit[1] >= 1))  ||
        typeof cvox !== "undefined" || mobileAccessibility.scriptInjected) return;
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.async = true;
    script.onload = function(){
        // console.log(this.src + ' has loaded');
        if (mobileAccessibility.isChromeVoxActive()) {
            cordova.fireWindowEvent("screenreaderstatuschanged", {
                isScreenReaderRunning: true
            });
        }
    };

    script.src = (versionsplit[0] > 4 || versionsplit[1] > 3)
github phonegap / phonegap-mobile-accessibility / www / mobile-accessibility.js View on Github external
MobileAccessibility.prototype.activateOrDeactivateChromeVox = function(bool) {
    if (device.platform !== "Android") return;
    if (typeof cvox === "undefined") {
        if (bool) {
            console.warn('A screen reader is running but ChromeVox has failed to initialize.');
            if (navigator.connection.type === Connection.UNKNOWN || navigator.connection.type === Connection.NONE) {
                mobileAccessibility.injectLocalAndroidVoxScript();
            }
        }
    } else {
        // activate or deactivate ChromeVox based on whether or not or not the screen reader is running.
        try {
            cvox.ChromeVox.host.activateOrDeactivateChromeVox(bool);
        } catch (err) {
            console.error(err);
        }
    }
github phonegap / phonegap-mobile-accessibility / www / mobile-accessibility.js View on Github external
MobileAccessibility.prototype.isTalkBackRunning = function(callback) {
    if (device.platform.toLowerCase() === "android" || device.platform.toLowerCase() === "amazon-fireos") {
        MobileAccessibility.prototype.isScreenReaderRunning(callback);
    } else {
        callback(false);
    }
};
MobileAccessibility.prototype.isChromeVoxActive = function () {
github phonegap / phonegap-mobile-accessibility / www / mobile-accessibility.js View on Github external
MobileAccessibility.prototype.isVoiceOverRunning = function(callback) {
    if (device.platform.toLowerCase() === "ios") {
        MobileAccessibility.prototype.isScreenReaderRunning(callback);
    } else {
        callback(false);
    }
};
MobileAccessibility.prototype.isTalkBackRunning = function(callback) {

cordova-plugin-device

Cordova Device Plugin

Apache-2.0
Latest version published 6 months ago

Package Health Score

73 / 100
Full package analysis