Page 1 of 1

Check device resolution

Posted: Thu Oct 29, 2020 12:43 pm
by matty47
How can I check the device resolution on android with Spiderbasic? I tried a small program using ExamineDesktop but this seems to give an incorrect answer. I would like to be able to make an app that adapts to different screen resolutions. Thanks.

Re: Check device resolution

Posted: Thu Oct 29, 2020 1:21 pm
by Peter
Android: Test resolution screen: viewtopic.php?f=13&t=1288

Re: Check device resolution

Posted: Fri Oct 30, 2020 1:37 am
by matty47
Thanks for the link. Was able to take some of the code.
Minimal example that worked OK

Code: Select all

CloseDebugOutput()
 Global width, height
 
  !v_width = screen.width * window.devicePixelRatio;
  !v_height = screen.height * window.devicePixelRatio;
  
  result =MessageRequester("Resolution: "+Str(width)+" x "+Str(height),#PB_MessageRequester_Ok)
  
  If result
    End
 EndIf