protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); RequestPermissions(permissionGroup, 0); SupportMapFragment mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(this); if (!PlacesApi.IsInitialized) { string key = Resources.GetString(Resource.String.mapkey); PlacesApi.Initialize(this, key); } startTripButton = (Button)FindViewById(Resource.Id.startTripButton); placeLayout = (RelativeLayout)FindViewById(Resource.Id.placeLayout); centerMarker = (ImageView)FindViewById(Resource.Id.centerMarker); placeTextView = (TextView)FindViewById(Resource.Id.placeTextView); getDirectionButton = (Button)FindViewById(Resource.Id.getDirectionsButton); locationButton = (ImageButton)FindViewById(Resource.Id.locationButton); locationButton.Click += LocationButton_Click; getDirectionButton.Click += GetDirectionButton_Click; startTripButton.Click += StartTripButton_Click; placeLayout.Click += PlaceLayout_Click; CreateLocationRequest(); }
void ConnectControl() { Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_menu_action_white); SupportActionBar.SetDisplayHomeAsUpEnabled(true); pickupLbl = (TextView)FindViewById(Resource.Id.pickupLbl); destinationupLbl = (TextView)FindViewById(Resource.Id.destinationupLbl); RelativeLayout layoutPickUp; RelativeLayout layoutDestination; layoutPickUp = (RelativeLayout)FindViewById(Resource.Id.layoutPickUp); layoutDestination = (RelativeLayout)FindViewById(Resource.Id.layoutDestination); layoutPickUp.Click += layoutPickUp_Click; layoutDestination.Click += layoutDestination_Click; if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, Resources.GetString(Resource.String.mapApiKey)); } }
private void StartLocation_Click(object sender, EventArgs e) { pin.Visibility = ViewStates.Visible; IsDirectionRequestInitlialized = false; GetDirection.Visibility = ViewStates.Visible; GetDirection.SetText("GET DIRECTION".ToCharArray(), 0, "GET DIRECTION".ToCharArray().Length); if (!radioStart.Checked && !radioEnd.Checked) { Toast.MakeText(Application.Context, "Please select one Type\nDestination OR Location", ToastLength.Long).Show(); } else { if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this.Activity, "AIzaSyD8-hqAD2UZX-8VSVoxOpabG2zW1RnmfzE"); } List <Place.Field> fields = new List <Place.Field>(); fields.Add(Place.Field.Id); fields.Add(Place.Field.Name); fields.Add(Place.Field.LatLng); fields.Add(Place.Field.Address); Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.Overlay, fields) .Build(this.Activity); StartActivityForResult(intent, 0); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.addaddress_activity); if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, GlobalVariables.GoogleApiKey); } List <Place.Field> fields = new List <Place.Field> { Place.Field.Id, Place.Field.Name, Place.Field.LatLng, Place.Field.Address }; Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.Overlay, fields) .SetCountry("US") .SetCountry("UK") .Build(this); StartActivityForResult(intent, 0); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); textView = (TextView)FindViewById(Resource.Id.pickupLocationText); relativeLayout = (RelativeLayout)FindViewById(Resource.Id.layoutPickUp); relativeLayout.Click += locateNeighbor; var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); try { mapFragment.GetMapAsync(this); } catch (Exception ex) { Console.WriteLine("Exception from code: " + ex); } if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, "AIzaSyD2pTTGb7qTTVK1PQ0HqdqGOUJfFGfpvP4"); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.MapLayout); GoogleApiClient = new GoogleApiClient.Builder(this, this, this) .EnableAutoManage(this, 0, this) .AddApi(Android.Gms.Location.Places.PlacesClass.GEO_DATA_API) .AddApi(Android.Gms.Location.Places.PlacesClass.PLACE_DETECTION_API) .Build(); InitializeLocationManager(); if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, GetString(Resource.String.google_key)); } //Get Value And Set Toolbar InitComponent(); } catch (Exception e) { Console.WriteLine(e); } }
private void InitPlacesApi() { if (PlacesApi.IsInitialized) { return; } PlacesApi.Initialize(this, GetString(Resource.String.google_api_key)); }
void InitilizePlaces() { string mapkey = Resources.GetString(Resource.String.mapkey); if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, mapkey); } }
//check and initialize places API key private void CheckAndInitializePlacesAPI() { if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, Application.Context.Resources.GetString(Resource.String.PlacesAPIKey)); } fields = new List <Place.Field>(); fields.Add(Place.Field.Id); fields.Add(Place.Field.Name); fields.Add(Place.Field.LatLng); fields.Add(Place.Field.Address); }
public override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RetainInstance = true; if (!PlacesApi.IsInitialized) { string key = GetString(Resource.String.google_key); PlacesApi.Initialize(Activity, key); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); // загрузка карты myMapView = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map); myMapView.GetMapAsync(this); //кнопка поиска searchButton = (Button)FindViewById <Button>(Resource.Id.btnOpenSearch); searchButton.Click += BtnOpenSearch_Click; if (!PlacesApi.IsInitialized) { // запуск поиска места PlacesApi.Initialize(this, "AIzaSyBPZtIau36YyBHlcA9doKwiSBp0hqpdf_U"); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); displayButton = (Button)FindViewById(Resource.Id.displayButton); addressText = (TextView)FindViewById(Resource.Id.addressText); nameText = (TextView)FindViewById(Resource.Id.nameText); coordiateText = (TextView)FindViewById(Resource.Id.cordinateText); displayButton.Click += DisplayButton_Click; if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, "AIzaSyAnJxOKPKQOjE5-add your own api key"); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Locations); //initializing components set_location = FindViewById <Button>(Resource.Id.btn_set_1); //srch_button = FindViewById<Button>(Resource.Id.btn_srch_1); //srch_text = FindViewById<EditText>(Resource.Id.search_text); Xamarin.Essentials.Platform.Init(this, savedInstanceState); map1 = MapFragment.NewInstance(); var ft = FragmentManager.BeginTransaction(); ft.Add(Resource.Id.map_placeholder, map1).Commit(); map1.GetMapAsync(this); //setting on click events set_location.Click += Set_location_Click; //srch_button.Click += Srch_button_Click; if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, "AIzaSyD8-hqAD2UZX-8VSVoxOpabG2zW1RnmfzE"); } List <Place.Field> fields = new List <Place.Field>(); fields.Add(Place.Field.Id); fields.Add(Place.Field.Name); fields.Add(Place.Field.LatLng); fields.Add(Place.Field.Address); Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.Overlay, fields) .SetCountry("PK") .Build(this); StartActivityForResult(intent, 0); }
private void Imgsearchicon_Click(object sender, EventArgs e) { if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, APIKEY); } List <Place.Field> fields = new List <Place.Field>(); fields.Add(Place.Field.Id); fields.Add(Place.Field.Name); fields.Add(Place.Field.LatLng); fields.Add(Place.Field.Address); Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.Overlay, fields) .Build(this); StartActivityForResult(intent, 0); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Title = "Google Places Sample"; if (string.IsNullOrWhiteSpace(apiKey)) { Toast.MakeText(this, "No API key defined in MainActivity.cs", ToastLength.Long).Show(); return; } if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, apiKey); } placesClient = PlacesApi.CreateClient(this); placesData = new List <PlaceData> (); InitializeComponents(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); ConnectControl(); SupportMapFragment mapFragment = (SupportMapFragment)SupportFragmentManager.FindFragmentById(Resource.Id.map); mapFragment.GetMapAsync(this); CheckLocationPermission(); CreateLocationRequest(); GetMyLocation(); StartLocationUpdates(); profileEventListener.Create(); if (!PlacesApi.IsInitialized) { string mapkey = Resources.GetString(Resource.String.mapkey); PlacesApi.Initialize(this, mapkey); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; txt = (TextView)FindViewById(Resource.Id.txt1); txt2 = (TextView)FindViewById(Resource.Id.txt2); txt3 = (TextView)FindViewById(Resource.Id.txt3); txt4 = (TextView)FindViewById(Resource.Id.txt4); if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(this, "AIzaSyD2J-IFSewL3lC7F8YucJB6JAkbb_IlSkQ"); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource if (!PlacesApi.IsInitialized) { string key = GetString(Resource.String.google_key); PlacesApi.Initialize(Activity, key); } List <Place.Field> fields = new List <Place.Field>(); fields.Add(Place.Field.Id); fields.Add(Place.Field.Name); fields.Add(Place.Field.LatLng); fields.Add(Place.Field.Address); Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.Overlay, fields) .SetCountry("RUS") .Build(Activity); StartActivityForResult(intent, 0); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.map, container, false); //Map mapFragment = (SupportMapFragment)ChildFragmentManager.FindFragmentById(Resource.Id.map); //Place if (!PlacesApi.IsInitialized) { PlacesApi.Initialize(Activity, "AIzaSyBYxu6LmRE5baH64VLCfgZFJo1xaImdZw4"); } //TextViews startDestinationText = view.FindViewById <TextView>(Resource.Id.txtStartDestination); endDestinationText = view.FindViewById <TextView>(Resource.Id.txtEndDestination); TimerText = view.FindViewById <TextView>(Resource.Id.txtTimer); TimerTotalText = view.FindViewById <TextView>(Resource.Id.txtTotalTime); DistanceTotalText = view.FindViewById <TextView>(Resource.Id.txtTotalDistance); SpeedText = view.FindViewById <TextView>(Resource.Id.txtSpeed); //Buttons startRadio = view.FindViewById <RadioButton>(Resource.Id.rbtnStartDestination); endRadio = view.FindViewById <RadioButton>(Resource.Id.rbtnEndDestination); mapStartButton = view.FindViewById <Button>(Resource.Id.btnMapStart); mapDoneButton = view.FindViewById <Button>(Resource.Id.btnMapDone); datasheetDoneButton = view.FindViewById <Button>(Resource.Id.btnDatasheetDone); //ImageView centreMarker = view.FindViewById <ImageView>(Resource.Id.centreMarker); runCentreMarker = view.FindViewById <ImageView>(Resource.Id.runCentreMarker); //Layouts layoutStartDestination = view.FindViewById <RelativeLayout>(Resource.Id.layoutStartDestination); layoutEndDestination = view.FindViewById <RelativeLayout>(Resource.Id.layoutEndDestination); //Bottomsheets FrameLayout timerView = view.FindViewById <FrameLayout>(Resource.Id.timer_bottomsheet); timerBottomSheetBehaviour = BottomSheetBehavior.From(timerView); FrameLayout datasheetView = view.FindViewById <FrameLayout>(Resource.Id.datasheet_bottomsheet); datasheetBottomSheetBehaviour = BottomSheetBehavior.From(datasheetView); //Methods mapFragment.GetMapAsync(this); CheckLocationPermission(); CreateLocationRequest(); GetMyLocation(); StartLocationUpdates(); //Events layoutStartDestination.Click += LayoutStartDestination_Click; layoutEndDestination.Click += LayoutEndDestination_Click; startRadio.Click += StartRadio_Click; endRadio.Click += EndRadio_Click; mapStartButton.Click += MapStartButton_Click; datasheetDoneButton.Click += DatasheetDoneButton_Click; mapDoneButton.Click += MapDoneButton_Click; return(view); }