[[["เข้าใจง่าย","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-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"]]