That is likely the problem.  getPlatformName() will return the name of the
platform that is being simulated on the simulator  (You can use
Display.isSimulator() to check if you're in the simulator).  If you pass in
a maps provider, that is ONLY used in the simulator, and it will cause the
MapContainer to fall back to use the old MapComponent when in the
simulator.  Further, GoogleMapsProvider uses the static maps API (
https://developers.google.com/maps/documentation/static-maps/), but it
looks like you are passing in keys for the Android and iOS SDKs - neither
of which will work with the static maps API.

If you simply pass in a string with your Javascript API key (rather than
passing in a MapProvider), it will cause the simulator to use the Google
maps vector based API inside a webview, which will be closer to the way it
works on device.

There is an example here:
https://www.codenameone.com/blog/new-improved-native-google-maps.html

Steve

On Fri, Apr 28, 2017 at 9:05 AM, <[email protected]> wrote:

> I am passing a GMaps key in the constructor:
>
> if (Display.getInstance().getPlatformName().equals("and")) {
>             cnt = new MapContainer(new GoogleMapsProvider(Constants.
> ANDROID_GMAPS_API_KEY));
>         } else {
>             cnt = new MapContainer(new GoogleMapsProvider(Constants.
> APPLE_GMAPS_API_KEY));
> }
>
> I'm assuming if it was a real issue on the device, it would be throwing
> exceptions?
>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "CodenameOne Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at https://groups.google.com/
> group/codenameone-discussions.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/codenameone-discussions/53950712-a9ea-42cc-a4ab-
> aea69897739d%40googlegroups.com
> <https://groups.google.com/d/msgid/codenameone-discussions/53950712-a9ea-42cc-a4ab-aea69897739d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Steve Hannah
Software Developer
Codename One
http://www.codenameone.com

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/CAGOYrKVTrNkvCeypHvYWmNPU2cmOCLmJ9vEPRX1hv--uNFrc-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to