I have a user that has a 4 Fold and is having problems.
I want to be able to detect if the device is fold-able and wrote this code
I don't have a fold-able device so on all my devices this returns false.
Was wondering if someone had a device that folded and could let me know if this routine returns true.
Thanks
BobVal
I want to be able to detect if the device is fold-able and wrote this code
B4X:
#Region IsDeviceFoldable
Private Sub IsDeviceFoldable As Boolean
Dim Sensor_Hinge As String = "android.hardware.sensor.hinge_angle"
Try
Dim jo As JavaObject
jo.InitializeContext
Dim IsFoldable As Boolean = False
IsFoldable = jo.RunMethodJO("getPackageManager", Null).RunMethod("hasSystemFeature", Array(Sensor_Hinge))
LogColor($"IsDeviceFoldable ${IsFoldable}"$, Colors.Red)
Return IsFoldable
Catch
LogColor($"IsDeviceFoldable Failed - ${LastException.Message}"$, Colors.Red)
Return False
End Try
End Sub
#end Region
I don't have a fold-able device so on all my devices this returns false.
Was wondering if someone had a device that folded and could let me know if this routine returns true.
Thanks
BobVal