D 
		
				
			
		Deleted member 103
Guest
Hi,
I use this code to determine if a device is suitable for my app.
The suitable devices should have at least a display of 5" inches.
A customer tells me that "Huawei p20 mate pro", with 6.4" inch display, is excluded from my app, how can it be?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I use this code to determine if a device is suitable for my app.
The suitable devices should have at least a display of 5" inches.
A customer tells me that "Huawei p20 mate pro", with 6.4" inch display, is excluded from my app, how can it be?
			
				B4X:
			
		
		
		    If Not(mBBL.IsTablet) Then
       log("Device not compatible with the app")
   End If
Public Sub IsTablet As Boolean
    If ExactSize > 4.69 Then ' 4.69 = 5 Zoll ?
        Return True
    Else
        Return False
    End If
End Sub
Public Sub ExactSize As Double
    Dim r As Reflector
    r.Target = r.GetContext
    r.Target = r.RunMethod("getResources")
    r.Target = r.RunMethod("getDisplayMetrics")
    Dim xdpi As Double = r.GetField("xdpi")
    Dim ydpi As Double = r.GetField("ydpi")
    'Return Sqrt(Power(100%x / xdpi, 2) + Power(100%y / ydpi, 2))
    Dim lv As LayoutValues
    lv = GetDeviceLayoutValues
    Dim size As Double  = Sqrt(Power(lv.Width / xdpi, 2) + Power(lv.Height / ydpi, 2))
    'Log("ExactSize=" & size)
    Return size
End Sub