On mobile devices, your best bet is probably just to rely on the screen size reported by Platform Info. That is in CSS pixels so does not vary with the device pixel ratio,
Unfortunately, when I change scaling/text size in my phone settings, this changes the screen size in CSS pixels reported by PlatformInfo, as well as the device pixel ratio.
Same phone, different settings:
CanvasCssHeight=510, pixel ratio=2.1
CanvasCssHeight=320, pixel ratio=3.37