Android Question warning #35

SMOOTSARA

Active Member
Licensed User
Longtime User
🌹 Hello friends
Where is the mistake in this section?🙏


CodeModule - 2661: Comparison of Object to other types will fail if exact types do not match.
Better to put the object on the right side of the comparison. (warning #35)



B4X:
Sub CheckForGooglePlayServices As Boolean
Try
    

    Dim GoogleApiAvailablity As JavaObject
    GoogleApiAvailablity = GoogleApiAvailablity.InitializeStatic("com.google.android.gms.common.GoogleApiAvailability").RunMethod("getInstance", Null)
 
    Dim context As JavaObject
    context.InitializeContext
  
    Log(GoogleApiAvailablity.RunMethod("isGooglePlayServicesAvailable", Array(context)))
  
    If GoogleApiAvailablity.RunMethod("isGooglePlayServicesAvailable", Array(context)) <> 0 Then
        
        GoogleApiAvailablity.RunMethod("makeGooglePlayServicesAvailable", Array(context))
        Return False
    Else
        Return True
    End If
    
    Catch
        Return False
        LogColor(LastException,Colors.Red)
    End Try
End Sub


1592423482921.png
 
Top