首页 文章

使用Cordova获取设备信息

提问于
浏览
0

我知道使用Cordova device plugin我可以访问平台,型号,制造商等信息 .

是否可以使用Cordova或兼容的东西获取设备存储容量或RAM使用统计信息?我会为IOS,Android,Windows和Blackberry看这个 .

1 回答

  • 1

    Cordova device plugin定义了一个全局设备对象,它描述了设备的硬件和软件 . 虽然该对象位于全局范围内,但在deviceready事件之后才可用 .

    document.addEventListener("deviceready", onDeviceReady, false);
        function onDeviceReady() {
            // Android:    Nexus One       returns "Passion" (Nexus One code name)
    //             Motorola Droid  returns "voles"
    // BlackBerry: Torch 9800      returns "9800"
    // Browser:    Google Chrome   returns "Chrome"
    //             Safari          returns "Safari"
    // iOS:     for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models
    // OSX:                        returns "x86_64"
    // 
    var model = device.model;
            // Depending on the device, a few examples are:
    //   - "Android"
    //   - "BlackBerry 10"
    //   - "browser"
    //   - "iOS"
    //   - "WinCE"
    //   - "Tizen"
    //   - "Mac OS X"
    var devicePlatform = device.platform;
        }
    

    请仔细阅读文档,其中包含所有信息 .

相关问题