Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Getting Device info using phone gap

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 446
    Comment on it

    In phonegap, if we want to know the device information then we have to add a plugin for the same and from that we will have a device object which describe the hardware and software of the device.

    The properties include:

    device.name
    device.version
    device.cordova
    device.uuid
    device.model
    device.version
    

    This is how we can get the values as the device is assigned to the window object so it is in the global scope.

    var phoneModel = window.device.model;
    

    This is how to can have the information of all the above things in a variable.
    Now, adding plugin for device:

    $ cordova plugin add org.apache.cordova.device
    $ cordova plugin ls
    

    From this we can get the required information by just placing the code inside.

    document.addEventListener("deviceready", onDeviceReady, false);
    

    Hope this will help you in getting device information.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: