I'm using the following code to check if the user is using a dark mode or the light mode.
If i have the light mode the result is 1, but if i have the dark mode on, then the returning number is a 1 too.
Tested on simulator and a real device
If i have the light mode the result is 1, but if i have the dark mode on, then the returning number is a 1 too.
B4X:
Public Sub IsDarkMode As Boolean
Dim app As Application
If app.OSVersion < 13 Then Return False
Dim no As NativeObject = app.KeyController
Return no.GetField("traitCollection").GetField("userInterfaceStyle").AsNumber = 2
End Sub
Dynamic dark and light modes
As Apple is requiring all new apps (in April 2020) to support iOS 13 at a minimum, I'd like to update my app to support the user's system choice of light or dark mode as part of the iOS 13 compatibility. However, I'm not sure how to implement this in b4i. From Apple's documentation, it looks...
www.b4x.com
Tested on simulator and a real device