protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_place_search);

            ApiKey        = Intent.Extras.GetString("apiKey");
            SearchService = SearchServiceFactory.Create(this, Uri.Encode(ApiKey));

            ResultTextView         = FindViewById <TextView>(Resource.Id.textview_text_search_results);
            QueryInput             = FindViewById <EditText>(Resource.Id.edittext_text_search_query);
            LatitudeInput          = FindViewById <EditText>(Resource.Id.edittext_lat);
            LongitudeInput         = FindViewById <EditText>(Resource.Id.edittext_lon);
            RadiusInput            = FindViewById <EditText>(Resource.Id.edittext_radius);
            LanguageInput          = FindViewById <EditText>(Resource.Id.edittext_language);
            PageIndexInput         = FindViewById <EditText>(Resource.Id.edittext_page_index);
            PageSizeInput          = FindViewById <EditText>(Resource.Id.edittext_page_size);
            PoiTypeSpinner         = FindViewById <Spinner>(Resource.Id.spinner_nearby_search_poitype);
            PoiTypeSpinner.Adapter = new ArrayAdapter <LocationType>(this, Android.Resource.Layout.SimpleSpinnerItem, LocationType.Values().ToList());
            BoundStrict            = FindViewById <Switch>(Resource.Id.switch_nearby_search_strict_bounds);
            Switch UsePOITypeSwitch = FindViewById <Switch>(Resource.Id.switch_nearby_search_poitype);

            UsePOITypeSwitch.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e)
            {
                PoiTypeSpinner.Enabled = e.IsChecked;
            };

            SearchNearbyPlaceButton        = FindViewById <Button>(Resource.Id.btn_search_nearby_place);
            SearchNearbyPlaceButton.Click += delegate { ExecPlaceSearch(); };

            PoiTypeSpinner.Enabled = false;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_keyword);
            // Instantiate the SearchService object.
            ApiKey        = Intent.Extras.GetString("apiKey");
            SearchService = SearchServiceFactory.Create(this, Uri.Encode(ApiKey));

            QueryInput             = FindViewById <EditText>(Resource.Id.edit_text_text_search_query);
            LatInput               = FindViewById <EditText>(Resource.Id.edit_text_text_search_location_lat);
            LngInput               = FindViewById <EditText>(Resource.Id.edit_text_text_search_location_lng);
            RadiusInput            = FindViewById <EditText>(Resource.Id.edit_text_text_search_radius);
            PoiTypeSpinner         = FindViewById <Spinner>(Resource.Id.spinner_text_search_poitype);
            PoiTypeSpinner.Adapter = new ArrayAdapter <LocationType>(this, Android.Resource.Layout.SimpleSpinnerItem, LocationType.Values().ToList());

            Switch UsePOITypeSwitch = FindViewById <Switch>(Resource.Id.switch_text_search_poitype);

            UsePOITypeSwitch.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e)
            {
                PoiTypeSpinner.Enabled = e.IsChecked;
            };
            CountryInput   = FindViewById <EditText>(Resource.Id.edit_text_text_search_country);
            LanguageInput  = FindViewById <EditText>(Resource.Id.edit_text_text_search_language);
            PageIndexInput = FindViewById <EditText>(Resource.Id.edit_text_text_search_pageindex);
            PageSizeInput  = FindViewById <EditText>(Resource.Id.edit_text_text_search_pagesize);
            ResultTextView = FindViewById <TextView>(Resource.Id.response_text_search);

            Childern = FindViewById <Switch>(Resource.Id.switch_text_search_children);

            Search = FindViewById <Button>(Resource.Id.button_text_search);

            Search.Click += delegate { ExecTextSearch(); };

            PoiTypeSpinner.Enabled = false;
        }
        public async Task <IList <Restaurant> > GetRestaurantsAsync(Position position)
        {
            tcsResult = new TaskCompletionSource <bool>();

            _searchService = SearchServiceFactory.Create(Android.App.Application.Context, Android.Net.Uri.Encode("YOUR_API_KEY"));

            // Create SearchRequest
            NearbySearchRequest nearbySearchRequest = new NearbySearchRequest();

            nearbySearchRequest.Query         = "Istanbul";
            nearbySearchRequest.Language      = "en";
            nearbySearchRequest.PoliticalView = "TR";
            // Set Poi type as Restaurant
            nearbySearchRequest.PoiType = LocationType.Restaurant;
            //Set user's location for nearest restaurant search
            nearbySearchRequest.Location  = new Coordinate(position.Latitude, position.Longitude);
            nearbySearchRequest.Radius    = Java.Lang.Integer.ValueOf(10000);
            nearbySearchRequest.PageIndex = Java.Lang.Integer.ValueOf(1);
            nearbySearchRequest.PageSize  = Java.Lang.Integer.ValueOf(10);

            // Call the nearby place search API.
            _searchService.NearbySearch(nearbySearchRequest, this);

            await tcsResult.Task;

            return(restaurants);
        }
Exemple #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_place_suggestion_search);

            ApiKey        = Intent.Extras.GetString("apiKey");
            SearchService = SearchServiceFactory.Create(this, Uri.Encode(ApiKey));

            ResultTextView   = FindViewById <TextView>(Resource.Id.textview_pss_results);
            QueryInput       = FindViewById <EditText>(Resource.Id.edittext_search_query_pss);
            LatitudeInput    = FindViewById <EditText>(Resource.Id.edittext_lat_pss);
            LongitudeInput   = FindViewById <EditText>(Resource.Id.edittext_lon_pss);
            RadiusInput      = FindViewById <EditText>(Resource.Id.edittext_radius_pss);
            LanguageInput    = FindViewById <EditText>(Resource.Id.edittext_language_pss);
            CountryCodeInput = FindViewById <EditText>(Resource.Id.edittext_country_code_pss);

            NortheastLatInput = FindViewById <EditText>(Resource.Id.query_suggestion_bounds_northeast_lat_input);
            NortheastLngInput = FindViewById <EditText>(Resource.Id.query_suggestion_bounds_northeast_lng_input);
            SouthwestLatInput = FindViewById <EditText>(Resource.Id.query_suggestion_bounds_southwest_lat_input);
            SouthwestLngInput = FindViewById <EditText>(Resource.Id.query_suggestion_bounds_southwest_lng_input);

            Childern    = FindViewById <Switch>(Resource.Id.switch_query_suggestion_children);
            BoundStrict = FindViewById <Switch>(Resource.Id.switch_query_suggestion_strict_bounds);

            SearchPlaceSuggestionButton        = FindViewById <Button>(Resource.Id.btn_search_place_suggestion);
            SearchPlaceSuggestionButton.Click += delegate { ExecPlaceSuggestionSearch(); };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_place_detail_search);

            apiKey        = Intent.Extras.GetString("apiKey");
            searchService = SearchServiceFactory.Create(this, Uri.Encode(apiKey));

            resultTextView        = FindViewById <TextView>(Resource.Id.textview_place_detail_results);
            siteIdInput           = FindViewById <EditText>(Resource.Id.edittext_site_id);
            languageInput         = FindViewById <EditText>(Resource.Id.edittext_language_pds);
            getPlaceDetailsButton = FindViewById <Button>(Resource.Id.btn_get_place_details);

            getPlaceDetailsButton.SetOnClickListener(this);
        }
Exemple #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_place_detail_search);

            ApiKey        = Intent.Extras.GetString("apiKey");
            SearchService = SearchServiceFactory.Create(this, Uri.Encode(ApiKey));

            ResultTextView     = FindViewById <TextView>(Resource.Id.textview_place_detail_results);
            SiteIdInput        = FindViewById <EditText>(Resource.Id.edittext_site_id);
            LanguageInput      = FindViewById <EditText>(Resource.Id.edittext_language_pds);
            PlaceDetailsButton = FindViewById <Button>(Resource.Id.btn_get_place_details);

            Childern = FindViewById <Switch>(Resource.Id.switch_detail_search_children);
            PlaceDetailsButton.Click += delegate { ExecPlaceDetailSearch(); };
        }
        public void NearbySearch(LatLng currentLocation, string searchText)
        {
            ISearchService      searchService       = SearchServiceFactory.Create(activity, Android.Net.Uri.Encode("CgB6e3x9NPSZfsfsG8oVcTDTEpTRfRm5A1rF/cT2+mjcQWCv93U9FICe6Do6XM+9w+7ZtPONmSxgxUpOC8HEUV//"));
            NearbySearchRequest nearbySearchRequest = new NearbySearchRequest();

            nearbySearchRequest.Query    = searchText;
            nearbySearchRequest.Language = "en";
            if (currentLocation != null)
            {
                nearbySearchRequest.Location = new Coordinate(currentLocation.Latitude, currentLocation.Longitude);
            }
            nearbySearchRequest.Radius    = (Integer)2000;
            nearbySearchRequest.PageIndex = (Integer)1;
            nearbySearchRequest.PageSize  = (Integer)5;
            nearbySearchRequest.PoiType   = LocationType.Address;
            searchService.NearbySearch(nearbySearchRequest, new QuerySuggestionResultListener(activity as MainActivity));
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_auto_complete);
            // Instantiate the SearchService object.
            ApiKey        = Intent.Extras.GetString("apiKey");
            SearchService = SearchServiceFactory.Create(this, Uri.Encode(ApiKey));

            QueryInput         = FindViewById <EditText>(Resource.Id.query_suggestion_query_input);
            LatInput           = FindViewById <EditText>(Resource.Id.query_suggestion_location_lat_input);
            LngInput           = FindViewById <EditText>(Resource.Id.query_suggestion_location_lng_input);
            RadiusInput        = FindViewById <EditText>(Resource.Id.query_suggestion_radius_input);
            LanguageInput      = FindViewById <EditText>(Resource.Id.query_suggestion_language_input);
            Childern           = FindViewById <Switch>(Resource.Id.switch_query_auto_complete_children);
            AutoCompleteSearch = FindViewById <Button>(Resource.Id.search_query_auto_complete_button);
            ResultTextView     = FindViewById <TextView>(Resource.Id.response_text_search);

            AutoCompleteSearch.Click += delegate { QueryAutoComplete(); };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_place_suggestion_search);

            apiKey        = Intent.Extras.GetString("apiKey");
            searchService = SearchServiceFactory.Create(this, Uri.Encode(apiKey));

            resultTextView   = FindViewById <TextView>(Resource.Id.textview_pss_results);
            queryInput       = FindViewById <EditText>(Resource.Id.edittext_search_query_pss);
            latitudeInput    = FindViewById <EditText>(Resource.Id.edittext_lat_pss);
            longitudeInput   = FindViewById <EditText>(Resource.Id.edittext_lon_pss);
            radiusInput      = FindViewById <EditText>(Resource.Id.edittext_radius_pss);
            languageInput    = FindViewById <EditText>(Resource.Id.edittext_language_pss);
            countryCodeInput = FindViewById <EditText>(Resource.Id.edittext_country_code_pss);

            searchPlaceSuggestionButton = FindViewById <Button>(Resource.Id.btn_search_place_suggestion);
            searchPlaceSuggestionButton.SetOnClickListener(this);
        }