Android Question [SOLVED] Disable GPS if not exist

makis_best

Well-Known Member
Licensed User
Longtime User
Hi.

How I can disable GPS functionality if a device doesn't have GPS device.

Thank you
 
Solution
B4X:
Sub HasFeature (Feature As String) As Boolean
   Dim ctxt As JavaObject
   ctxt.InitializeContext
   Return ctxt.RunMethodJO("getPackageManager", Null).RunMethod("hasSystemFeature", Array(Feature))
End Sub

Feature: "android.hardware.location.gps"
Cookies are required to use this site. You must accept them to continue using the site. Learn more…