پوشاندن میدان مورد نیاز است. شما باید مشخص کنید که کدام فیلدها را می خواهید در پاسخ بازگردانید. هیچ لیست پیش فرضی از فیلدهای برگشتی وجود ندارد. اگر این لیست را حذف کنید، متدها با خطا مواجه می شوند.
بخش های بعدی تغییرات اضافی را توضیح می دهند.
دسترسی به انواع مکان های جدید
هر مکان می تواند یک یا چند مقدار نوع مرتبط با خود داشته باشد. Places SDK برای اندروید نسخه 3.3.0 و نسخه های جدیدتر مقادیر زیادی از نوع جدید را اضافه می کند. برای فهرست کامل، به انواع مکان های گسترده مراجعه کنید.
متد Place.getPlaceTypes() مقادیر نوع را به عنوان لیستی از مقادیر رشته برمی گرداند. مقادیر برگردانده شده به نسخه Places SDK برای Android شما بستگی دارد:
Places SDK برای Android (جدید) : رشته های تعریف شده توسط جدول A و جدول B نشان داده شده در انواع مکان (جدید) را برمی گرداند، از جمله تمام انواع مکان های اضافه شده در نسخه 3.3.0.
Places SDK برای Android : فهرست های تعریف شده توسط Place.Types را برمی گرداند که شامل انواع جدید اضافه شده در نسخه 3.3.0 و جدیدتر نمی شود.
به نظرات مکان دسترسی داشته باشید
Places SDK for Android (جدید) کلاس Review را اضافه می کند که شامل بررسی یک مکان است. شی Place می تواند حداکثر پنج نظر داشته باشد.
کلاس Review همچنین می تواند شامل یک منبع و یک منبع نویسنده باشد. اگر نظر را در برنامه خود نمایش دهید، باید هر گونه انتساب یا منبع نویسنده را نیز نمایش دهید. برای اطلاعات بیشتر، به نمایش مرور مراجعه کنید.
برای اطلاعات بیشتر، به اسناد مربوط به اسناد مراجعه کنید.
به کد زبان نام مکان دسترسی پیدا کنید
در Places SDK برای Android (Legacy)، متد Place.getName() یک رشته متنی حاوی نام مکان را برمیگرداند. برای پر کردن شی Place با نام مکان، باید Place.Field.DISPLAY_NAME در لیست فیلد درخواست جزئیات مکان قرار دهید.
شی Place اکنون حاوی کد زبان رشته نام است. برای پر کردن شیء Place با کد زبان، باید:
Place.Field.DISPLAY_NAME را در لیست فیلد درخواست قرار دهید. این مقدار پاسخ را به گونه ای پیکربندی می کند که نام مکان و کد زبان را در شیء Place شامل شود.
PlacesClient.fetchPlace() را فراخوانی کنید. PlacesClient.findCurrentPlace() از فیلد کد زبان پشتیبانی نمی کند.
Places SDK for Android (جدید) پارامتر درخواست کد منطقه را به جزئیات مکان اضافه می کند. کد منطقه برای قالب بندی پاسخ استفاده می شود که به عنوان مقدار کد CLDR دو کاراکتری مشخص شده است. این پارامتر همچنین می تواند یک اثر سوگیری در نتایج جستجو داشته باشد. هیچ مقدار پیش فرض وجود ندارد. برای تنظیم کد منطقه باید SDK جدید را فعال کنید.
اگر نام کشور فیلد آدرس در پاسخ با کد منطقه مطابقت داشته باشد، کد کشور از آدرس حذف می شود.
اکثر کدهای CLDR با کدهای ISO 3166-1 یکسان هستند، با برخی استثناهای قابل توجه. برای مثال، ccTLD بریتانیا "uk" (.co.uk) است در حالی که کد ISO 3166-1 آن "gb" است (از لحاظ فنی برای نهاد "پادشاهی متحده بریتانیای کبیر و ایرلند شمالی"). این پارامتر می تواند بر نتایج بر اساس قانون قابل اجرا تأثیر بگذارد.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Migrate to Place Details (New)\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n\n\u003cbr /\u003e\n\n| This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](/maps/documentation/places/android-sdk/legacy/cloud-setup#enabling-apis).\n\n\u003cbr /\u003e\n\nPlaces SDK for Android supports [Place Details (Legacy)](/maps/documentation/places/android-sdk/details-places).\nIf you are familiar with the Places SDK for Android (Legacy), [Place Details (New)](/maps/documentation/places/android-sdk/details-places)\nmakes the following changes:\n\n- Uses a new pricing model. For pricing information for all APIs, see [Places SDK for Android\n (New)](/maps/documentation/places/android-sdk/usage-and-billing#pricing-new).\n\n- You must initialize your app by calling the\n [`Places.initializeWithNewPlacesApiEnabled()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/Places#initializeWithNewPlacesApiEnabled(android.content.Context,%20java.lang.String))\n method. For more information on selecting the Places API service, see\n [Set up your Google Cloud project](/maps/documentation/places/android-sdk/legacy/cloud-setup).\n\n- Field masking is required. You must specify which fields you want returned\n in the response. There is no default list of returned fields. If you omit\n this list, the methods return an error.\n\nThe following sections describe additional changes.\n\nAccess new place types\n----------------------\n\nEach place can have one or more *type* values associated with it. The\nPlaces SDK for Android version 3.3.0 and later adds many new type\nvalues. For the complete list, see [Expanded place\ntypes](/maps/documentation/places/android-sdk/legacy/choose-sdk#expanded_place_types).\n\nThe\n[`Place.getPlaceTypes()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Place#getPlaceTypes())\nmethod returns the type values as a list of string values. The values returned\ndepend on your version of the Places SDK for Android:\n\n- **Places SDK for Android (New)** : Returns the strings defined by\n Table A and Table B shown on [Place Types (New)](/maps/documentation/places/android-sdk/legacy/place-types), including all\n the added place types added in version 3.3.0.\n\n- **Places SDK for Android** : Returns the enums defined by\n `Place.Types`, which does not include the new types added in version 3.3.0\n and later.\n\nAccess place reviews\n--------------------\n\nThe Places SDK for Android (New) adds the\n[`Review`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Review)\nclass, which contains a review of a place. The `Place` object can contain up to\nfive reviews.\n\nThe `Review` class can also contain an attribution and an author attribution. If\nyou display the review in your app, then you must also display any attribution\nor author attribution. For more information, see [Display a\nreview](/maps/documentation/places/android-sdk/legacy/policies#reviews).\n\nFor more information, see the documentation on\n[attributions](/maps/documentation/places/ios-sdk/policies#other_attribution_requirements).\n\nAccess place name language code\n-------------------------------\n\nIn the Places SDK for Android (Legacy),\n[`Place.getName()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Place#public-abstract-string-getname)\nmethod returns a text string containing the name of a place. To populate the\n`Place` object with the place name, you must include the\n`Place.Field.DISPLAY_NAME` in the field list of the place details request.\n\nThe `Place` object now contains the language code for the name string. To\npopulate the `Place` object with language code, you must:\n\n1. Include the `Place.Field.DISPLAY_NAME` in the field list of the request.\n This value configures response to include both the place name and language\n code in the `Place` object.\n\n2. Call\n [`PlacesClient.fetchPlace()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/net/PlacesClient#fetchPlace(com.google.android.libraries.places.api.net.FetchPlaceRequest)).\n `PlacesClient.findCurrentPlace()` does not support the language code field.\n\n3. Use the [`Place.getNameLanguageCode()`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/api/model/Place#public-abstract-string-getnamelanguagecode)\n method to access the language code field in the `Place` object.\n\nSet region code\n---------------\n\nPlaces SDK for Android (New) adds the region code request parameter to\nPlace Details. The region code is used to format the response, specified as a\n[two-character CLDR code](https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html)\nvalue. This parameter can also have a bias effect on the search results. There\nis no default value. You must enable the new SDK to set the region code.\n\nIf the country name of the address field in the response matches the region\ncode, the country code is omitted from address.\n\nMost CLDR codes are identical to ISO 3166-1 codes, with some notable exceptions.\nFor example, the United Kingdom's ccTLD is \"uk\" (.co.uk) while its ISO 3166-1\ncode is \"gb\" (technically for the entity of \"The United Kingdom of Great Britain\nand Northern Ireland\"). The parameter can affect results based on applicable\nlaw.\n\nExample request\n---------------\n\nFor a complete example, see [Place Details\n(New)](/maps/documentation/places/android-sdk/details-place)."]]