开发者

ScreenPixelsWidth / ScreenPixelsHeight for Android SDK Emulator is always 240x320

开发者 https://www.devze.com 2023-03-21 22:32 出处:网络
I\'m developing a mobile website using ASP.NET. For mobile device detection I use the 51degrees.mobi project. The detection and routing work well ... but the values for

I'm developing a mobile website using ASP.NET. For mobile device detection I use the 51degrees.mobi project. The detection and routing work well ... but the values for Request.Browser.ScreenPixelsWidth and Request.Browser.ScreenPixelsHeight are always 240 and 320 no matter what option for resolution in the android sdk manager I choose. E.g., if I select WVGA800 which should be 480x800 screen size for android, my websites always returns 240x320 for the resolution.

So, is this a known problem or what do I have to change in my ASP.NET 开发者_StackOverflow社区application OR the android sdk environment to come up with larger screen resolutions.

Thanks,

Konrad


The values returned in both ScreenPixelsHeight and ScreenPixelsWidth properties are not exact, they are approximate values based on calculations, check the msdn documentation for explanation, and in a previous version they show the actual calculation.

As far as I know the way to get the exact resolution of a client device is using javascript. But this is sometimes inconvenient because it is only available after the first request. So depending on what you're trying to accomplish different strategies must be considered.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号