if (System.getDeviceSettings().screenShape == System.SCREEN_SHAPE_SEMI_OCTAGON) {...}
Perfect!
Thanks
Note that SCREEN_SHAPE_SEMI_OCTAGON was first available with CIQ 3.3, which means you will need some additional code if you intend to:
- build with optimization disabled
and
- support older devices (e.g. fr935, which supports CIQ 3.1.6)
You can see the issue if you build and run the following code in the simulator for fr935 with optimization disabled:
if (System.getDeviceSettings().screenShape == System.SCREEN_SHAPE_SEMI_OCTAGON) { }
The app will crash with the following message in the debug console:
Error: Symbol Not Found Error
Details: Could not find symbol 'SCREEN_SHAPE_SEMI_OCTAGON'
The additional code you'd need is a "has check", to ensure that the System module has the SCREEN_SHAPE_SEMI_OCTAGON symbol.
e.g.
if ( System has :SCREEN_SHAPE_SEMI_OCTAGON && System.getDeviceSettings().screenShape == System.SCREEN_SHAPE_SEMI_OCTAGON ) { }
Although optimization does avoid this problem (by resolving enum values at compile time instead of run time), it's probably good practice to write this sort of defensive code anyway.
Thanks for the info. That's the kind of error that drives me nuts!
Instead of using screen share, with the instinct2/2s/2x and something like a watch face,device app or widget, you can also check for the subscreen as you probably want to do something with it - avoid it, use it for something special, etc