iOS Question Google Maps question

cwt

Active Member
Licensed User
Longtime User
Is it possible to click on a marker on a B4i generated Google Map and cause a B4XPage to display? In other words, can an event be generated with a marker click that can be intercepted and contain information to allow me to open a page? These markers are placed with the Lat and Lon that is stored in the customer record in the SQLIte database. I could place a record pointer in the marker snippet, for example, and use string slicing to get the record pointer and use the result to open the matching customer record page. In my primary business web site I do something similar with the Google Maps javascript API generated map and then use an ajax call embeded in the map to contact the web server to do specific tasks. Of course I know these are apples and oranges but capturing a map marker click event in iOS is the start.
 

cwt

Active Member
Licensed User
Longtime User
I figured out how to do this. I modified the "gmap_MarkerClick" sub from the GoggleMapsExtra example as shown below:

B4X:
Sub gmap_MarkerClick (SelectedMarker As Marker) 
    Dim RecordID As Int = SelectedMarker.Title
    Dim CustomerFound As Boolean = False
    Dim RS1 As ResultSet = Main.SQL1.ExecQuery("SELECT * FROM " & Main.CustomerTable & " WHERE customer_number = " & RecordID)
    Do While RS1.NextRow
        CustomerFound = True
        Main.MasterCustomerNumber = RS1.GetString("ID")
    Loop
    RS1.Close
    If CustomerFound = True Then
        B4XPages.ShowPage("CustomerRecord")
    End If 
End Sub

I just set the marker title to the record ID when creating the markers for the map. Works great.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
in my case, when I want to display information from the bookmark, I use this:

 
Upvote 0
Top