private void OnUberButtonClick(object sender, EventArgs e) { var uri = "http://maps.google.com/maps?&saddr=" + LocationService.CorrectLocationFormat(_currentLocation) + "&daddr=" + LocationService.CorrectLocationFormat(_placeLocation); var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri)); intent.SetPackage("com.ubercab"); if (IsPackageAvailable("com.ubercab")) { StartActivity(intent); } else { var marketIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("market://details?id=com.ubercab")); marketIntent.SetPackage("com.android.vending"); try { StartActivity(marketIntent); } catch (ActivityNotFoundException) { Toast.MakeText(Activity, GetString(Resource.String.Error_NoPlayStore), ToastLength.Long).Show(); } } }
private void OnMapButtonClick(object sender, EventArgs e) { var uri = "http://maps.google.com/maps?&saddr=" + LocationService.CorrectLocationFormat(_currentLocation) + "&daddr=" + LocationService.CorrectLocationFormat(_placeLocation); var geoUri = Android.Net.Uri.Parse(uri); var intent = new Intent(Intent.ActionView, geoUri); intent.SetPackage("com.google.android.apps.maps"); if (IsPackageAvailable("com.google.android.apps.maps")) { StartActivity(intent); } else { var marketIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("com.google.android.apps.maps")); marketIntent.SetPackage("com.android.vending"); if (IsPackageAvailable("com.android.vending")) { StartActivity(marketIntent); } else { Toast.MakeText(Activity, GetString(Resource.String.Error_NoPlayStore), ToastLength.Long); } } }
public async Task <List <GoogleResult> > GetNearByPlaces(LatLng location, int radius, string type, string keyword) { if (NetworkAvailability.Check()) { try { string json = string.Empty; if (type != null) { json = await DownloadString("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + LocationService.CorrectLocationFormat(location) + "&radius=" + radius *MetresInKm + "&type=" + type + "&keyword=" + keyword + "&key=" + StrGoogleApiKey); } else { json = await DownloadString("https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + LocationService.CorrectLocationFormat(location) + "&radius=" + radius *MetresInKm + "&keyword=" + keyword + "&key=" + StrGoogleApiKey); } var result = JsonConvert.DeserializeObject <GooglePlaceDetailsModel>(json); var places = result.results.Where(p => p.opening_hours == null ? false : p.opening_hours.open_now).ToList(); return(places); } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(null); }