Unfortunately I couldn't find an answer at Android Place Picker closes immediately after launch. For me the PlacePicker launches, shows location as Unknown and then returns with the resultCode 2.
To reaffirm some truths: My app has two activities so far. The first activity is a map, which works fine so far; no problem there. The second activity has a button that allows the user to launch the PlacePicker. The fact that the first activity launches the map with no problem should reinforce to you the reader that my manifest is fine and that my Google Api Console has the correct data. So that leaves me with: what am I doing wrong? I am using the exact example as https://developers.google.com/places/android-api/placepicker. In fact here is my code
try {
IntentBuilder builder = new IntentBuilder();
startActivityForResult(builder.build(this), REQUEST_PLACE_PICKER);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
and then
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (RESULT_OK != resultCode) {
Log.d(TAG,"bad result: "+resultCode);
return;
}
if (REQUEST_PLACE_PICKER == requestCode) {
Place place = PlacePicker.getPlace(data, this);
String toastMsg = String.format("Place: %s", place.getName());
Toast.makeText(this, toastMsg, Toast.LENGTH_LONG).show();
}
}
and here is my complete log
D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
W/IInputConnectionWrapper: showStatusIcon on inactive InputConnection
D/SRIB_DCS: log_dcs ThreadedRenderer::initialize entered!
D/AddLocationActivity: bad result: 2