Upon launching my Phonegap app on Android with the "deviceready" event, I am experiencing unusual behavior in terms of screen width values. Specifically, on a ZTE Blade device with a native 800px resolution, the screen.width returns false values such as 320, 533, or 787 px (while window.innerWidth remains consistent). This inconsistency persists even within a single app instance when querying multiple times...
In my AndroidManifest.xml file, I have set android:screenOrientation="landscape". The development environment includes Phonegap/Cordova 1.8.1 on Eclipse (Indigo).
Here are some sample values of screen.width:
in index.html
- before document.addEventListener+"deviceready": 320
- just after "deviceready": 320
Following three redirects (changing window.location to different HTML files) due to splash screens, the final page reached is main.html. For debugging purposes, I include my .js code in each file and observe the following console logs:
- 320
- 787
- 787
This inconsistent behavior is quite perplexing...