Android 我可以将安卓的PlacePicker控制权限制在特定国家/地区吗?

Android 我可以将安卓的PlacePicker控制权限制在特定国家/地区吗?,android,google-maps-api-3,google-maps-markers,gmsplacepicker,Android,Google Maps Api 3,Google Maps Markers,Gmsplacepicker,我正在使用Android提供的最新位置选择器控件。它真的很容易使用 现在,问题是: 我可以把搜索范围限制在印度吗 我可以更改PlacePicker控件中的默认标记图标吗 注意:我没有使用任何地图视图或片段来显示任何地图。我使用的是PlacePicker,而不是GoogleMap。这不是一种可靠的方法,只是一种解决方案,因此它在一定程度上是有效的。 public void onActivityResult(int requestCode, int resultCode, Intent dat

我正在使用Android提供的最新位置选择器控件。它真的很容易使用

现在,问题是:

  • 我可以把搜索范围限制在印度吗

  • 我可以更改PlacePicker控件中的默认标记图标吗


  • 注意:我没有使用任何地图视图或片段来显示任何地图。我使用的是PlacePicker,而不是GoogleMap。

    这不是一种可靠的方法,只是一种解决方案,因此它在一定程度上是有效的。
       public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == PLACE_PICKER_REQUEST) {
            if (resultCode == RESULT_OK) {
                Place place = PlacePicker.getPlace(mActivity, data);
                Log.d(TAG, "onActivityResult: " + place.getAddress());
                if (place.getAddress() != null) {
                    // ask for geolocation data
                    Geocoder gcd = new Geocoder(mActivity, Locale.getDefault());
    
                    try {
                        addresses = gcd.getFromLocation(place.getLatLng().latitude, place.getLatLng().longitude, 1);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
    
    
                    if (addresses.size() > 0) {
                        if (addresses.get(0).getCountryCode().equalsIgnoreCase(getString(R.string.india))) {
                            //write the code here
                        } else {
                            Toast.makeText(mActivity, "Invalid places", Toast.LENGTH_SHORT).show();
                        }
                    }
                }
            }
        }
    }