Solution: PhoneGap does not support viewport.
When you used phonegap to compile GameBuilder + CanTK a few days ago, the viewport in HTML is invalid. CanTK detects the DPI of the device based on devicePixelRatio and uses viewport to set the correct resolution. If viewport is invalid, CanTK can only run at the lowest resolution. I checked it online and did not find the system information. However, I know that WebView must have corresponding settings to enable viewport. Combined with the information found and the source code of phonegap, finally, the solution is found. Here is a summary:
- Solution for iOS: add a line of configuration in config. xml of phonegap:
<preference name="EnableViewportScale" value="true"/>
(The strange thing is that this method is invalid for the android platform. I have read CordovaWebView. java, and there are no relevant settings in it)
Solution 1 of the android platform: Modify CordovaWebView. java:
Settings. getUserAgentString (); // Add the following two lines of code: settings. setUseWideViewPort (true); settings. setLoadWithOverviewMode (true );
Solution 2 of the android platform: direct modification of CordovaWebView. java is a good solution. However, GameBuilder + CanTK supports cloud compilation of phonegap and cannot directly modify CordovaWebView. java. I thought of the phonegap plug-in and found a ViewPortScale plug-in. I found that it could not be compiled, so I wrote a com. tangide. viewport plug-in. If you use cloud compilation provided by GameBuilder + CanTK, this plug-in has been built in. The plug-in source code is here:
https://github.com/drawapp8/ViewPort