iOS Tutorial GoogleMaps Tutorial

Status
Not open for further replies.
The iGoogleMaps library allows you to show a map inside your app:

SS-2014-11-17_09.18.50.png


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: www.b4x.com/b4i/files/GoogleMaps.framework.zip (download it from your Mac).
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. Set the minimum version to 11:
B4X:
#MinVersion: 11

5. 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: https://www.b4x.com/b4i/files/GoogleMaps.zip

Updates:

- GoogleMaps iOS SDK v6.0.1 was uploaded to the builders.
Make sure to update Files\Special\GoogleMaps.bundle from the example project.
If using a local Mac then update the Mac frameworks (see step #2 above)
Set the minimum version to 11: #MinVersion: 11
 
Last edited:

davepamn

Active Member
Licensed User
Longtime User
copy to what libs directory? the application builder libs directory?
 

davepamn

Active Member
Licensed User
Longtime 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
Longtime 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
Longtime 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
Longtime 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
Longtime 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
Longtime User
What is the procedure if no one uses local Mac builder but hosted builder?
Thank you
 

schimanski

Well-Known Member
Licensed User
Longtime 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
Longtime 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
Longtime 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é."
 

ciginfo

Well-Known Member
Licensed User
Longtime User
It appears 25 or 30 seconds after
 

Attachments

  • error.png
    error.png
    24.3 KB · Views: 1,034
Status
Not open for further replies.
Top