Bu ürün veya özellik eski durumdadır. Eski durum hakkında daha fazla bilgi için
Eski ürünler ve özellikler başlıklı makaleyi inceleyin. iOS için Yerler API'ye(yeni) geçmek istiyorsanız
Taşıma rehberi'ne bakın.
Oturum Jetonları
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Yer Otomatik Tamamlama (eski) özelliği, kullanıcı otomatik tamamlama aramasının sorgu ve seçim aşamalarını faturalandırma amacıyla ayrı bir oturumda gruplandırmak için oturum jetonlarını kullanır. Oturum, kullanıcı bir sorgu yazmaya başladığında başlar ve bir yer seçip Yer Ayrıntıları (eski) çağrısı yapıldığında sona erer. Her oturumda birden fazla otomatik tamamlama sorgusu ve ardından bir yer seçimi olabilir. Bir oturumdaki her istek için kullanılan API anahtarları aynı Google Cloud Console projesine ait olmalıdır. Bir oturum sona erdiğinde jeton artık geçerli olmaz. Uygulamanız her oturum için yeni bir jeton oluşturmalıdır. sessiontoken
parametresi atlanırsa veya bir oturum jetonunu yeniden kullanırsanız oturum, oturum jetonu sağlanmamış gibi ücretlendirilir (her istek ayrı ayrı faturalandırılır).
Aşağıdaki yönergeleri uygulamanızı öneririz:
- Tüm otomatik tamamlama oturumları için oturum jetonları kullanın.
- Her oturum için yeni bir jeton oluşturun.
- Bir oturumdaki tüm Yer Otomatik Tamamlama (eski) ve Yer Ayrıntıları (eski) istekleri için kullanılan API anahtarlarının aynı Google Cloud Console projesine ait olduğundan emin olun.
- Her yeni oturum için benzersiz bir oturum jetonu gönderdiğinizden emin olun. Aynı jetonun birden fazla oturumda kullanılması, her isteğinin ayrı olarak faturalandırılmasına neden olur.
İsteğe bağlı olarak otomatik tamamlama oturum jetonunu isteklerden çıkarabilirsiniz. Oturum jetonu atlanırsa her istek ayrı olarak faturalandırılır ve Otomatik Tamamlama - İstek Başına SKU'su tetiklenir. Bir oturum jetonunu yeniden kullanırsanız oturum geçersiz kabul edilir ve istekler, oturum jetonu sağlanmamış gibi ücretlendirilir.
Örnek
Kullanıcı bir sorgu yazarken birkaç tuş vuruşunda bir otomatik tamamlama isteği çağrılır (karakter başına değil) ve olası sonuçların listesi döndürülür.
Kullanıcı sonuç listesinden bir seçim yaptığında bu seçim bir istek olarak sayılır ve arama sırasında yapılan tüm istekler birleştirilerek tek bir istek olarak sayılır. Kullanıcı bir yer seçerse arama sorgusu ücretsizdir ve yalnızca yer verisi isteği ücretlendirilir. Kullanıcı, oturumun başlangıcından sonraki birkaç dakika içinde bir seçim yapmazsa yalnızca arama sorgusu için ödeme alınır.
Bu etkinlik akışını bir uygulamanın bakış açısından inceleyelim.
- Kullanıcı, "Paris, Fransa" araması yapmak için bir sorgu yazmaya başlar.
- Uygulama, kullanıcı girişini algıladıktan sonra "A jetonu" adlı yeni bir oturum jetonu oluşturur.
- Kullanıcı yazarken API birkaç karakterde bir otomatik tamamlama isteği gönderir ve her biri için olası sonuçların yeni bir listesini gösterir:
"P"
"Par"
"Paris,"
"Paris, Fr"
- Kullanıcı bir seçim yaptığında:
- Sorgudan kaynaklanan tüm istekler gruplandırılır ve "A jetonu" ile temsil edilen oturuma tek bir istek olarak eklenir.
- Kullanıcının seçimi bir yer ayrıntısı isteği olarak sayılır ve "A jetonu" ile temsil edilen oturuma eklenir.
- Oturum sona erer ve uygulama "A jetonu"nu atar.
Otomatik Yer Tamamlama (eski) isteklerinin nasıl faturalandırıldığı hakkında daha fazla bilgi edinmek için Kullanım ve Faturalandırma bölümüne bakın.
Oturum jetonları oluşturma
Oturum jetonu oluşturmak için GMSAutocompleteSessionToken.init()
işlevini çağırın.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-31 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-31 UTC."],[],[],null,["# Session Tokens\n\nSelect platform: [Android](/maps/documentation/places/android-sdk/session-tokens \"View this page for the Android platform docs.\") [iOS](/maps/documentation/places/ios-sdk/session-tokens \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/places-autocomplete#session_tokens \"View this page for the JavaScript platform docs.\") [Web Service](/maps/documentation/places/web-service/session-tokens \"View this page for the Web Service platform docs.\")\n\nPlace Autocomplete (Legacy) uses session tokens to group the query and selection\nphases of a user autocomplete search into a discrete session for billing\npurposes. The session begins when the user starts typing a query, and concludes\nwhen they select a place and a call to Place Details (Legacy) is made. Each session can\nhave multiple autocomplete queries, followed by one place selection. The API\nkey(s) used for each request within a session must belong to the same\nGoogle Cloud console project. Once a session has concluded, the token is no longer\nvalid; your app must generate a fresh token for each session. If the\n`sessiontoken` parameter is omitted, or if you reuse a session\ntoken, the session is charged as if no session token was provided (each request\nis billed separately).\n\nWe recommend the following guidelines:\n\n- Use session tokens for all autocomplete sessions.\n- [Generate a fresh token](#create-session-tokens) for each session.\n- Ensure that the API key(s) used for all Place Autocomplete (Legacy) and Place Details (Legacy) requests within a session belong to the same Google Cloud console project.\n- Be sure to pass a unique session token for each new session. Using the same token for more than one session will result in each request being billed individually.\n\nYou can optionally omit the autocomplete session token from a request. If\nthe session token is omitted, each request is billed separately, triggering the\n\n[Autocomplete - Per Request](/maps/billing-and-pricing/sku-details#autocomplete-request-new-ess-sku)\n\n\nSKU. If you reuse a session token, the session is considered invalid and the\nrequests are charged as if no session token was provided.\n\nExample\n-------\n\nAs the user types a query, an autocomplete request is called every few\nkeystrokes (not per-character), and a list of possible results is returned.\nWhen the user makes a selection from the result list, the selection counts as\na request, and all of the requests made during the search are bundled and\ncounted as a single request. If the user selects a place, the search query is\navailable at no charge, and only the Place data request is charged. If the user does not make a\nselection within a few minutes of the beginning of the session, only the\nsearch query is charged.\n\nLet's examine this flow of events from the perspective of an app.\n\n1. A user begins typing a query to search for \"Paris, France\".\n2. Upon detecting user input, the app creates a new session token, \"Token A\".\n3. As the user types, the API makes an autocomplete request every few characters, displaying a new list of potential results for each: \n \"P\" \n \"Par\" \n \"Paris,\" \n \"Paris, Fr\" \n4. When the user makes a selection:\n - All requests resulting from the query are grouped and added to the session represented by \"Token A\", as a single request.\n - The user's selection is counted as a Place Detail request, and added to the session represented by \"Token A\".\n5. The session is concluded, and the app discards \"Token A\".\n\nFor more information about how Place Autocomplete (Legacy) requests are billed, see\n\n[Usage and Billing](/maps/documentation/places/ios-sdk/usage-and-billing).\n\nCreate session tokens\n---------------------\n\n\nTo create a session token, call\n[`GMSAutocompleteSessionToken.init()`](/maps/documentation/places/ios-sdk/reference/interface_g_m_s_autocomplete_session_token)."]]