public void openPlaceAutoCompleteView() { mMap.clear(); this.listLatLng.clear(); try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } }
private void openAutocompleteActivity() { try { // The autocomplete activity requires Google Play Services to be available. The intent // builder checks this and throws an exception if it is not the case. Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE); } catch (GooglePlayServicesRepairableException e) { // Indicates that Google Play Services is either not installed or not up to date. Prompt // the user to correct the issue. GoogleApiAvailability.getInstance().getErrorDialog(this, e.getConnectionStatusCode(), 0 /* requestCode */).show(); } catch (GooglePlayServicesNotAvailableException e) { // Indicates that Google Play Services is not available and the problem is not easily // resolvable. String message = "Google Play Services is not available: " + GoogleApiAvailability.getInstance().getErrorString(e.errorCode); Log.e(TAG, message); Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } }
private void openAutocompleteActivity() { try { // The autocomplete activity requires Google Play Services to be available. The intent // builder checks this and throws an exception if it is not the case. Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE); } catch (GooglePlayServicesRepairableException e) { // Indicates that Google Play Services is either not installed or not up to date. Prompt // the user to correct the issue. GoogleApiAvailability.getInstance().getErrorDialog(this, e.getConnectionStatusCode(), 0 /* requestCode */).show(); } catch (GooglePlayServicesNotAvailableException e) { // Indicates that Google Play Services is not available and the problem is not easily // resolvable. String message = "Google Play Services is not available: " + GoogleApiAvailability.getInstance().getErrorString(e.errorCode); Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show(); } }
@Override public void afterTextChanged(Editable s) { String location = s.toString(); if (TextUtils.isEmpty(location)) return; if (location.equals(oldLocation)) return; try { Intent build = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN).zzh(s.toString()). build((Activity) context); startActivityForResult(build, AUTO_COMP_REQ_CODE); } catch (GooglePlayServicesRepairableException e) { e.printStackTrace(); } catch (GooglePlayServicesNotAvailableException e) { e.printStackTrace(); } oldLocation = location; }