Search code examples
htmljquery-mobilephonegap-desktop-app

How Many Pixels in a PhoneGap Screen?


I have started to use PhoneGap for mobile development and I had some issues with the number of pixels in the length and height of the screen. What is the standard number of pixels in the HTML screen for PhoneGap? Is it still the standard 960px like it is in desktop development? Or does it depend on the device itself?

Regards,

Ani

EDIT

This is not a repeat of "How to find the screen resolution of an Android device." I did not find this as a direct answer to my question here. Even though the correct answer is found here, I did not realize it. I believed there to be a fixed number of pixels in the HTML screen for mobile devices. This is also more broad than Android devices and extends to all mobile devices. Please excuse me for wasting your time on a possible duplicate.


Solution

  • Every device model has a different screen resolution.

    Use the following to figure out the display size in pixels with PhoneGap

     function getDeviceDimention() {
            console.log("Device Dimention using PhoneGap");
            console.log("Width = " + window.innerWidth);
            console.log("Height = " + window.innerHeight);
        }