Exemplo n.º 1
0
        public static void ShowPlacePicker([NotNull] Action <Place> onPlacePicked, [NotNull] Action <string> onFailure)
        {
            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            if (onPlacePicked == null)
            {
                throw new ArgumentNullException("onPlacePicked");
            }

            if (onFailure == null)
            {
                throw new ArgumentNullException("onFailure");
            }

            _onPlacePicked = onPlacePicked;
            _onFailure     = onFailure;

            GooglePlacesSceneHelper.Init();

            if (GoogleMapUtils.IsAndroid)
            {
                PlacePickerActivityUtils.LaunchPlacePicker();
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            _googleMapsShowPlacePicker();
#endif
        }
Exemplo n.º 2
0
        public static void ShowPlaceAutocomplete(
            [NotNull] Action <Place> onPlacePicked,
            [NotNull] Action <string> onFailure,
            [GoogleMapsAndroidOnly] Mode mode = Mode.Fullscreen, AutocompleteFilter filter = AutocompleteFilter.None,
            string countryCode = null, LatLngBounds boundsBias = null)
        {
            if (onPlacePicked == null)
            {
                throw new ArgumentNullException("onPlacePicked");
            }
            if (onFailure == null)
            {
                throw new ArgumentNullException("onFailure");
            }

            if (GoogleMapUtils.IsPlatformNotSupported)
            {
                return;
            }

            _onPlacePicked = onPlacePicked;
            _onFailure     = onFailure;

            GooglePlacesSceneHelper.Init();

            if (GoogleMapUtils.IsAndroid)
            {
                PlacePickerActivityUtils.LaunchPlaceAutocomplete(mode, filter, countryCode, boundsBias);
            }

#if UNITY_IOS && !DISABLE_IOS_GOOGLE_MAPS
            string bounds = null;
            if (boundsBias != null)
            {
                bounds = Json.Serialize(boundsBias.ToDictionary());
            }

            _googleMapsShowPlaceAutocomplete((int)mode, (int)filter, countryCode, bounds);
#endif
        }