Android Question google_play_services_version

Carlo2015

Member
Licensed User
Longtime User
Hi

Sorry if i created a new thread as the original post of warwound is too much info for me to read.

I followed the steps by warwound and i'm trying to make an app which uses the fusedlocationprovider and i get this error

AndroidManifest.xml:20: error: Error: No resource found that matches the given name (at 'value' with value '@Integer/google_play_services_version').

Please note that its a tracker so no interface/map is needed onscreen as its send a formatted SMS to our gateway and the monitoring is done online like fleet management (web-based)

the libs used so far are

CORE 4.01
fusedlocationprovider 1.31
GPS 1.20

I already installed google play services using the sdk manager but cant find google-play-services.jar so what i did was donwloaded the r29 from this post on stackoverflow

https://stackoverflow.com/questions...-older-google-play-services/26838281#26838281

I do not know what to get so i downloaded

https://dl-ssl.google.com/android/repository/google_play_services_8487000_r29.zip

and extracted google-play-services.jar and copied it to the libs folder of b4a. what am i missing here?

Please help. TIA
 

Carlo2015

Member
Licensed User
Longtime User
this is my sample code

B4X:
#Region  Project Attributes
    #ApplicationLabel: B4A Example
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private FusedLocationProvider1 As FusedLocationProvider
    Private LastLocation As Location
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    
    If FirstTime Then
        FusedLocationProvider1.Initialize("FusedLocationProvider1")
    End If
End Sub

Sub Activity_Resume
    FusedLocationProvider1.Connect
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    FusedLocationProvider1.Disconnect
End Sub

Sub FusedLocationProvider1_ConnectionFailed(ConnectionResult1 As Int)
    Log("FusedLocationProvider1_ConnectionFailed")
    
    '    the FusedLocationProvider ConnectionResult object contains the various CoonectionResult constants
    
    Select ConnectionResult1
        Case FusedLocationProvider1.ConnectionResult.NETWORK_ERROR
            '    a network error has occurred, this is likely to be a recoverable error
            '    so try to connect again
            FusedLocationProvider1.Connect
        Case Else
            '    TODO handle other errors
    End Select
End Sub

Sub FusedLocationProvider1_ConnectionSuccess
    Log("FusedLocationProvider1_ConnectionSuccess")
    Dim LocationRequest1 As LocationRequest
    LocationRequest1.Initialize
    LocationRequest1.SetInterval(1000)    '    1000 milliseconds
    LocationRequest1.SetPriority(LocationRequest1.Priority.PRIORITY_HIGH_ACCURACY)
    LocationRequest1.SetSmallestDisplacement(1)    '    1 meter
    FusedLocationProvider1.RequestLocationUpdates(LocationRequest1)
End Sub

Sub FusedLocationProvider1_ConnectionSuspended(SuspendedCause1 As Int)
    Log("FusedLocationProvider1_ConnectionSuspended")
    
    '    the FusedLocationProvider SuspendedCause object contains the various SuspendedCause constants
    
    Select SuspendedCause1
        Case FusedLocationProvider1.SuspendedCause.CAUSE_NETWORK_LOST
            '    TODO take action
        Case FusedLocationProvider1.SuspendedCause.CAUSE_SERVICE_DISCONNECTED
            '    TODO take action
    End Select
End Sub

Sub FusedLocationProvider1_LocationChanged(Location1 As Location)
    Log("FusedLocationProvider1_LocationChanged")
    LastLocation=Location1
    ToastMessageShow(DateTime.Time(LastLocation.Time)&" ("&LastLocation.Latitude&", "&LastLocation.Longitude&")", True)
End Sub
 
Upvote 0

Carlo2015

Member
Licensed User
Longtime User
Hi Erel

Before I head on to upgrade my license to v8, can you please assure me that I would be able to achieve of getting the coordinates without having to turn on the GPS of the phone?

Thanks,

Carlo
 
Upvote 0
Top