Hello All,
I'm using this sample code to implement location services in an app: https://www.b4x.com/android/forum/threads/location-gps.46148/#content
I notice that, in the sample, when locManager.Initialize("LocManager") is called , Iphone automatically shows a message requesting authorization on screen and after user select the event LocManager_AuthorizationStatusChanged is raised.
I replicated the code in my app but the request authorization message isn't being opened and instantly after LocaManager.initialize the event LocManager_AuthorizationStatusChanged (Status As Int) shows locManager.IsAuthorized = false. I already reseted the authorizations of iPhone but it's still happening . Sample app runs fine.
Is there any additional configuration that I'm eventually missing?
PlistExtra is added:
And the code of the module that requests location is:
I'm using this sample code to implement location services in an app: https://www.b4x.com/android/forum/threads/location-gps.46148/#content
I notice that, in the sample, when locManager.Initialize("LocManager") is called , Iphone automatically shows a message requesting authorization on screen and after user select the event LocManager_AuthorizationStatusChanged is raised.
I replicated the code in my app but the request authorization message isn't being opened and instantly after LocaManager.initialize the event LocManager_AuthorizationStatusChanged (Status As Int) shows locManager.IsAuthorized = false. I already reseted the authorizations of iPhone but it's still happening . Sample app runs fine.
Is there any additional configuration that I'm eventually missing?
PlistExtra is added:
B4X:
#PlistExtra:<key>NSLocationWhenInUseUsageDescription</key><string>Sua localização será acessada somente agora para buscarmos os melhores estabelecimentos perto de você.</string>
#PlistExtra:<key>NSLocationUsageDescription</key><string>Sua localização será acessada somente agora para buscarmos os melhores estabelecimentos perto de você.</string>
And the code of the module that requests location is:
B4X:
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private addressList As CustomListView
Private imgGps As ImageView
Private lblGps As Label
Private txtAddress As TextField
Dim timer1 As Timer
#if B4i
Private hud1 As HUD
Private locManager As LocationManager
#End If
End Sub
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("addressSelectLayout")
timer1.Initialize("timer1",2000)
addressList.Clear
End Sub
Private Sub lblGps_Click <---- location is required when the user clicks a label.
#if B4i
locManager.Initialize("LocManager")
#end if
End Sub
#if B4i
Private Sub LocManager_AuthorizationStatusChanged (Status As Int)
Log("Autorizado location -> " & locManager.IsAuthorized)
locManager.Stop
End Sub
#end if