display.topStatusBarContentHeight not working

I’m pretty sure your solution will *not* work on Android.  The reason is that Android won’t display the status bar immediately because the operation is posted on another thread.  That means you’ll get a value of zero in this case.

Yes, your solution will work for the top status bar on iOS.  I’m not sure if it’ll work on Android since displaying its top status bar is done via another thread, meaning the status bar is not shown yet by the time you are reading its height.

So, the only solution proper is to get the status bar height upon opening the app and store it in a global?

I don’t recommend that you store it at all.  I recommend that you fetch it dynamically via our display.topStatusBarContentHeight instead in case the value changes on you.

Wait…you just wrote I can’t know the height of the status bar on Android unless I magically know when the ‘show’ operation finishes. What I want to do is

(a) show the status bar,

and

(b) layout the screen based on the height of the status bar.

You’re writing that unless the status bar is showing, I won’t know its height…so I can’t layout the screen properly. Help?

>> you just wrote I can’t know the height of the status bar on Android unless I magically know when the ‘show’ operation finishes

I’m actually not 100% positive about this.  I recommend that you try it for yourself.  I’ve yet to hear about any status bar issues on Android, so it may work fine.