iOS Tutorial GoogleMaps Tutorial

Status
Not open for further replies.

Erel

Administrator
Staff member
Licensed User
The iGoogleMaps library allows you to show a map inside your app:



It is similar to B4A GoogleMaps library.

1. In order to use it you need to get a free api key from Google. Follow the "Obtaining an API Key" steps: https://developers.google.com/maps/documentation/ios/start#obtaining_an_api_key

2. If you are using a local Mac builder then you need to first download the SDK to your Mac computer: https://www.b4x.com/android/forum/threads/googlemaps-tutorial.47019/page-3#post-358138
And copy GoogleMaps.framework package to the Libs folder.

Start with the attached project. You will need to change the package name.

When you are ready to start a new project you need to:
3. Add these two attributes to your project (if you want to show the user location):
B4X:
#PlistExtra:<key>NSLocationWhenInUseUsageDescription</key><string>Used to display the current navigation data.</string>
#PlistExtra:<key>NSLocationUsageDescription</key><string>Used to display the current navigation data.</string>
You can change the description text.

4. Copy the GoogleMaps.bundle folder from the example project (under Files\Special) to Files\Special in your project.

You can download the example project from: www.basic4ppc.com/b4i/files/GoogleMaps.zip
 
Last edited:

davepamn

Active Member
Licensed User
When you say copy GoogleMaps.Framework under macserver-aa/libs

will I see macserver-aa/Libs/GoogleMaps.Framework when done?
 
Last edited:

davepamn

Active Member
Licensed User
I looked at the googlemaps example and saw the plist items were inserted in the project section of the code
 
Last edited:

davepamn

Active Member
Licensed User
I created the "Key for iOS apps (with bundle identifiers)"

Build Configurations
Configuration Name=Default
Package: anywhere software.b4i.googlemaps

B4X:
PrivateApiKeyAsString = "AIzaSyA-xxxxxxxxxx"
In the googlemaps demo code

I get a grey screen with no map. (Resolved)

It is working
I changed the version number and iTunes updated the code then the map display.
Great Job
 
Last edited:

davepamn

Active Member
Licensed User
How do I add a google Map to a tab controller Page?

I need to load google maps into a panel on my frmPage4 Layout.

B4X:
gmap.Initialize("gmap", ApiKey)

    'Page4.RootPanel.AddView(gmap, 0, 0, 100%X, 100%y)

    panelMap.AddView(gmap, 0, 0, 100%X, 100%y)

    gmap.MapType = gmap.MAP_TYPE_TERRAIN

    gmap.GetUiSettings.CompassEnabled = True

    gmap.GetUiSettings.MyLocationButtonEnabled = True

    gmap.MyLocationEnabled = True
The app crashes when using this code.
 
Last edited:

davepamn

Active Member
Licensed User
the error message is "Google Maps SDK for iOS to be part of your target under "Copy Bundle Resources""

I forgot to "Copy the GoogleMaps.bundle folder from the example project (under Files\Special) to Files\Special in your project."

I copied the "GoogleMaps.bundle" from sample data. Is that the correct process
 
Last edited:

ciginfo

Well-Known Member
Licensed User
What is the procedure if no one uses local Mac builder but hosted builder?
Thank you
 

schimanski

Well-Known Member
Licensed User
In B4A, it is possible to set 'showinfowindow' on true or false. This is usefull to update the infowindow, if the title or the snippet has changed. Is it possoble in B4i to update an markers infowindow, during the infowindow is shown?
 

schimanski

Well-Known Member
Licensed User
Yes, I have tested it. In b4a and b4i, it is not possible to update an open marker-window.
 

ciginfo

Well-Known Member
Licensed User
Impossible to test the attached project GoogleMaps. I have changed the package name to "com.ciginfo.maps"
Below the 2 last lines of the error message

"Sending data to remote compiler. Error
Le thread a été abandonné."
 
Status
Not open for further replies.
Top