Pravee7094
Active Member
Hello all,
I used below coding to find current location latitude and longitude
Manifest Editor :
I checked other three mobile phones, this code was perfectly worked and gave the correct output(Latitude, Longitude)
But Not worked in "Samsung Galaxy M30s".
Is there any security issue? or any blocked permission ?
when see the app permission, the location permission was granted. But This "GPS_LocationChanged(Location1 As Location)" function is not executed on that mobile(Samsung Galaxy M30s).
Any suggestion?
Thanks
I used below coding to find current location latitude and longitude
B4X:
Sub Process_Globals
Private gr_runtimepermission As RuntimePermissions
Public gg_gps As GPS
Private gg_gpsStarted As Boolean
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layout")
gg_gps.Initialize("GPS")
End sub
Sub Activity_Resume
If gg_gps.GPSEnabled = False Then
ToastMessageShow("Enable the GPS device.", True)
StartActivity(gg_gps.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
gr_runtimepermission.CheckAndRequest(gr_runtimepermission.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
StartGps
End If
End Sub
Sub Activity_Pause (UserClosed As Boolean)
StopGps
End Sub
Public Sub StartGps
If gg_gpsStarted = False Then
Log("Gps Started")
gg_gps.Start(0, 0)
gg_gpsStarted = True
End If
End Sub
Public Sub StopGps
If gg_gpsStarted Then
gg_gps.Stop
gg_gpsStarted = False
End If
End Sub
Sub GPS_LocationChanged(Location1 As Location)
is_latitude = Location1.Latitude
is_longitude = Location1.Longitude
Log("Latitude value : " & is_latitude)
Log("Longitude value : " & is_longitude)
StopGps
End Sub
Manifest Editor :
B4X:
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
AddPermission(android.permission.ACCESS_FINE_LOCATION)
I checked other three mobile phones, this code was perfectly worked and gave the correct output(Latitude, Longitude)
But Not worked in "Samsung Galaxy M30s".
Is there any security issue? or any blocked permission ?
when see the app permission, the location permission was granted. But This "GPS_LocationChanged(Location1 As Location)" function is not executed on that mobile(Samsung Galaxy M30s).
Any suggestion?
Thanks