Android Question RESOLVED - StartGPS not found

Lee Gillie CCP

Active Member
Licensed User
Longtime User
We have not needed to work with this project for a while. Last time we did we were using B4A V9.8. Today trying to bring this up to date. We are advancing target SDK from 28 to 31. We have B4A 11.8 installed. But we are getting an error we don't understand, nor how to fix..

Main - 196: Sub 'StartGPS' not found. (warning #25):
Sub Activity_Resume
  
    Log("******* Main.Activity_Resume: Started")
  
    Wait For (CheckProviderInstaller) complete (success As Boolean)

    lblVersion.Text = "Eljay Delivery " & Application.VersionName & " (" & Application.VersionCode & ") on " & GlobalModule.ServiceHostName & GlobalModule.Secured
    lblVersion.Enabled = True

    lblCheckInOutStatus.Text = "You are currently checked " & GlobalModule.GetSettingDefaulted(GlobalModule.CHECKIN_STATE,"OUT")

    If Starter.GPS1.GPSEnabled = False Then
        ToastMessageShow("Please enable the GPS device.", True)
        StartActivity(Starter.GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
    Else
        Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Result Then CallSubDelayed(Starter, "StartGPS")
    End If[
/CODE]

Note: We see GPS 1.20 listed in libraries.
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
If Result Then CallSubDelayed(Starter, "StartGPS")
the sub StartGPS is missing in the Starterservice

Check the tutorial again and check your implementation
 
Upvote 0

Serge Bertet

Active Member
Licensed User
No need for CallSubDelayed, just write.
B4X:
If Result Then Starter.StartGPS
Starter service has already started when you are in activity_resume
 
Upvote 0

Serge Bertet

Active Member
Licensed User
These 2 subs should be present in starter service
B4X:
' GNSS start
public Sub GnssStart
    If gnssStarted Then Return
    myGnss.Start(100, 0)
    gnssStarted = True
End Sub

' GNSS stop
public Sub GnssStop
    If Not( gnssStarted ) Then Return
    myGnss.Stop
    gnssStarted = False
End Sub

PS: better to use GNSS instead of GPS now.
 
Upvote 0

Lee Gillie CCP

Active Member
Licensed User
Longtime User
the sub StartGPS is missing in the Starterservice

Check the tutorial again and check your implementation
This resolved the load error. I added the routines from the tutorial related to starting and stopping the service. It's working now, so that's is my main concern, but I still don't understand why this compiled and built before, but wont with only B4A version update.

Thanks so much for the tutorial reference and taking time to reply!!
 
Upvote 0
Top