■ Platform
Android
iOS
■ Documentation : https://github.com/pbakondy/cordova-plugin-screensize
Code: Select all
;https://github.com/pbakondy/cordova-plugin-screensize
Declare PluginInit(onSuccess, onError)
Declare successCallback(Result)
Declare errorCallback()
Import "cordova plugin add cordova-plugin-screensize"
EndImport
PluginInit(@successCallback(), @errorCallback())
Procedure PluginInit(onSuccess, onError)
!document.addEventListener("deviceready", function() {
! window.plugins.screensize.get(v_onsuccess, v_onerror);
!});
EndProcedure
Procedure successCallback(Result)
Protected Width, Height, Xdpi, Ydpi
!console.log(v_result);
!v_width = v_result.width
!v_height = v_result.height
!v_xdpi = v_result.xdpi
!v_ydpi = v_result.ydpi
Debug DeviceInfo(#PB_Device_Platform) + " - Version " + DeviceInfo(#PB_Device_Version)
Debug "Dimension " + Str(Height) + " / " + Str(Width)
Debug "Pixel per inch X:" + StrF(Xdpi, 3) + " dpi Y:" + StrF(Ydpi, 3) + " dpi"
EndProcedure
Procedure errorCallback()
Debug "error"
EndProcedure
Debug wrote: Android - Version 5.1
Dimension 720 / 1196
Pixel per inch X:326.571 dpi Y:328.404 dpi