Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Bu kılavuzda, oyununuzu en yeni Giriş SDK'sını kullanacak şekilde nasıl taşıyacağınız açıklanmaktadır. 1.0.0 beta SDK'sı, önceki 0.0.4 önizlemesine kıyasla önemli iyileştirmeler içeriyor. Mümkün olan en kısa sürede önceki önizlemelerden geçiş yapmanız gerekir. 0.0.4 SDK'sı Mart 2023'e kadar çalışmaya devam edecektir.
Bağımlılığı güncelleme
0.0.4 kitaplığı artık maven'de mevcut olduğundan libs dizininizden silin. Ardından modül düzeyindeki build.grade dosyanızda şu satırı bulun:
publicclassMyInputMapProviderextendsInputMappingProvider{@NonNull@OverridepublicInputMaponProvideInputMap(){// TODO: return an InputMap}}
Ardından, InputMappingProvider özelliğini uygulamak için şu şekilde değiştirin:
publicclassMyInputMapProviderimplementsInputMappingProvider{@NonNull@OverridepublicInputMaponProvideInputMap(){// TODO: return an InputMap}}
Yeni GirişClient'ı kullanma
registerInputMappingProvider ve unregisterInputMappingProvider, setInputMappingProvider ve clearInputMappingProvider ile değiştirildi.
Ayrıca clearInputMappingProvider artık bağımsız değişken almadığı için daha sonra kaydını iptal etmek üzere sağlayıcınıza referans tutmanıza gerek kalmadı.
Kotlin
Giriş harita sağlayıcınızı kaydetmek için registerInputMappingProvider ile yaptığınız aramayı bulun:
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-27 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-07-27 UTC."],[],[],null,["# Migrate to the 1.0.0-beta Input SDK\n\nThis guide describes how to migrate your game to use the latest\nInput SDK. The 1.0.0-beta SDK has substantial improvements over the\nprevious 0.0.4 preview. You should migrate from the earlier previews as soon as\npossible. The 0.0.4 SDK will continue function through March 2023.\n\nUpdate the dependency\n---------------------\n\nDelete the 0.0.4 library from your `libs` directory since the library is now\navailable on maven. Then Find this line in your module-level `build.grade`\nfile: \n\n implementation files('libs/inputmapping-0.0.4.aar')\n\nReplace it with the following code: \n\n implementation 'com.google.android.libraries.play.games:inputmapping:1.0.0-beta'\n\nImplement the new InputMappingProvider interface\n------------------------------------------------\n\nThe former abstract class `InputMappingProvider` turned into an interface in\nversion `1.0.0-beta`. The method `onProvideInputMap()` is still part of the\ninterface.\n\n\u003cbr /\u003e\n\n### Kotlin\n\n\u003cbr /\u003e\n\nRemove `()` from the class definition since there's no constructor to invoke in\n`InputMappingProvider`.\n\nLocate your `InputMappingProvider` implementation: \n\n class MyInputMapProvider : InputMappingProvider() {\n override fun onProvideInputMap(): InputMap {\n TODO(\"Not yet implemented\")\n }\n }\n\nAnd update it to this: \n\n class MyInputMapProvider : InputMappingProvider {\n override fun onProvideInputMap(): InputMap {\n TODO(\"Not yet implemented\")\n }\n }\n\n\u003cbr /\u003e\n\n### Java\n\n\u003cbr /\u003e\n\nReplace `extends` with `implements` to indicate that your implementing an\ninterface rather than extending a class.\n\nLocate where you extend `InputMappingProvider`: \n\n public class MyInputMapProvider extends InputMappingProvider {\n @NonNull\n @Override\n public InputMap onProvideInputMap() {\n // TODO: return an InputMap\n }\n }\n\nAnd change it to implement `InputMappingProvider`: \n\n public class MyInputMapProvider implements InputMappingProvider {\n @NonNull\n @Override\n public InputMap onProvideInputMap() {\n // TODO: return an InputMap\n }\n }\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUse the new InputClient\n-----------------------\n\n`registerInputMappingProvider` and `unregisterInputMappingProvider` have been\nreplaced with `setInputMappingProvider` and `clearInputMappingProvider`.\nFurther, `clearInputMappingProvider` no longer takes an argument so you no\nlonger need to keep a reference to your provider to unregister it later.\n\n\u003cbr /\u003e\n\n### Kotlin\n\nTo register your input map provider, locate your call to `registerInputMappingProvider`:\n\n\u003cbr /\u003e\n\n private val myInputMapProvider by lazy {\n MyInputMapProvider()\n }\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n\n val inputMappingClient = Input.getInputMappingClient(this)\n inputMappingClient.registerInputMappingProvider(myInputMapProvider)\n }\n\nAnd replace it with `setInputMappingProvider`: \n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n setContentView(R.layout.activity_main)\n\n val inputMappingClient = Input.getInputMappingClient(this)\n inputMappingClient.setInputMappingProvider(MyInputMapProvider())\n }\n\nTo clear your input map, locate your call to `unregisterInputMappingProvider`: \n\n override fun onDestroy() {\n val inputMappingClient = Input.getInputMappingClient(this)\n inputMappingClient.unregisterInputMappingProvider(myInputMapProvider)\n\n super.onDestroy()\n }\n\nAnd replace it with `clearInputMappingprovider`: \n\n override fun onDestroy() {\n val inputMappingClient = Input.getInputMappingClient(this)\n inputMappingClient.clearInputMappingProvider()\n\n super.onDestroy()\n }\n\n\u003cbr /\u003e\n\n### Java\n\n\u003cbr /\u003e\n\nTo register your input map provider, locate your call to\n`registerInputMappingProvider`: \n\n private final MyInputMapProvider myInputMapProvider = new MyInputMapProvider();\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n InputMappingClient inputMappingClient = Input.getInputMappingClient(this);\n inputMappingClient.registerInputMappingProvider(myInputMapProvider);\n }\n\nAnd replace it with `setInputMappingProvider`: \n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_main);\n\n InputMappingClient inputMappingClient = Input.getInputMappingClient(this);\n inputMappingClient.setInputMappingProvider(new MyInputMapProvider());\n }\n\nTo clear your input mapping provider, locate your call to\n`unregisterInputMappingProvider`: \n\n @Override\n protected void onDestroy() {\n InputMappingClient inputMappingClient = Input.getInputMappingClient(this);\n inputMappingClient.unregisterInputMappingProvider(myInputMapProvider);\n\n super.onDestroy();\n }\n\nAnd replace it with `clearInputMappingProvider`: \n\n @Override\n protected void onDestroy() {\n InputMappingClient inputMappingClient = Input.getInputMappingClient(this);\n inputMappingClient.clearInputMappingProvider();\n\n super.onDestroy();\n }\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e"]]