5e0805a813
Thanks for the fix of `JavaClassWrapper` in https://github.com/godotengine/godot/pull/96182 and the changes in the previous commit, this introduces an `AndroidRuntime` plugin which provides GDScript access to the Android runtime capabilities. This allows developers to get access to various Android capabilities without the need of a plugin. For example, the following logic can be used to check whether the device supports vibration: ``` var android_runtime = Engine.get_singleton("AndroidRuntime") if android_runtime: print("Checking if the device supports vibration") var vibrator_service = android_runtime.getApplicationContext().getSystemService("vibrator") if vibrator_service: if vibrator_service.hasVibrator(): print("Vibration is supported on device!") else: printerr("Vibration is not supported on device") else: printerr("Unable to retrieve the vibrator service") else: printerr("Couldn't find AndroidRuntime singleton") ``` |
||
---|---|---|
.. | ||
android | ||
ios | ||
linuxbsd | ||
macos | ||
web | ||
windows | ||
register_platform_apis.h | ||
SCsub |