A few days ago, when compiling GAMEBUILDER+CANTK with PhoneGap, the viewport in HTML was found to be invalid. The CANTK detects the DPI of the device according to the Devicepixelratio and then sets the correct resolution with viewport. If viewport is not valid, CANTK can only run at the lowest resolution. Check on the Internet, also did not find the system information, but I know webview must have the corresponding settings to enable viewport, combined with the information found and PhoneGap source, finally found a solution, here to summarize:
Workaround for the
- iOS platform: Add a single line of configuration in config. phonegap:
<preference name= "Enableviewportscale" value= " True "/>
(strange that this method is not valid for Android platform, I looked at Cordovawebview.java, there is no related settings)
-
Android Workaround for Platform One: Modify Cordovawebview.java:
settings.getuseragentstring (); //add the following two lines of code: settings.setusewideviewport (true );
Settings.setloadwithoverviewmode (true );
-
Workaround for Android platform two: it's a good idea to modify Cordovawebview.java directly, but GAMEBUILDER+CANTK supports PhoneGap cloud compilation, There is no way to modify Cordovawebview.java directly. I think of the phonegap plug-in, found a Viewportscale plug-in, found that the basic compiler can not, so I wrote a com.tangide.viewport plug-in, if the use of GAMEBUILDER+CANTK provided by the cloud compilation, This plugin has been built in. Plugin source code is here:
https: // Github.com /drawapp8/viewport
To resolve several ways that PhoneGap does not support viewport