Hello, my problem is the following: I am writing an application on android using Google place API.
Everything works when I try to choose the nearest place, or enter it in the line Does not work when I try to find a place by the beacon on the map.
I checked the API key. I really hope for help. I can’t find a solution for a long time.
calling code and result:
try { PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder(); Intent intent = intentBuilder.build(this); // Start the Intent by requesting a result, identified by a request code. startActivityForResult(intent, 1); // Hide the pick option in the UI to prevent users from starting the picker // multiple times. } catch (GooglePlayServicesRepairableException e) { GooglePlayServicesUtil .getErrorDialog(e.getConnectionStatusCode(), this, 0); } catch (GooglePlayServicesNotAvailableException e) { Toast.makeText(this, "Google Play Services is not available.", Toast.LENGTH_LONG) .show(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data){ if (resultCode==RESULT_OK && requestCode==1) { final Place place = PlacePicker.getPlace(data, this); Toast.makeText(this, place.getAddress(), Toast.LENGTH_LONG) .show(); Firebase ref = new Firebase("https://unlimeted-house.firebaseio.com/users/" + userId); Map<String, Object> setLocation = new HashMap<String, Object>(); // setLocation.put("location", place.getAddress()); double lati = place.getLatLng().latitude; double longi = place.getLatLng().longitude; //ref.child("locationlatitude").setValue(Double.toString(lati)); //ref.child("locationlongitude").setValue(Double.toString(longi)); newUser.put("locationlatitude", Double.toString(lati)); newUser.put("locationlongitude", Double.toString(longi)); ref.setValue(newUser); Location userLoc = new Location("asd"); userLoc.setLatitude(place.getLatLng().latitude); userLoc.setLongitude(place.getLatLng().longitude); Hawk.put("userLoc", userLoc); plaseExists = true; } } 