Type Number Object InputDevice Revision Release 2021.3646 Keywords device, input, androidDeviceId
The unique integer ID assigned to the input device by Android.
Note that the ID assigned to the input device can change after rebooting the Android device. This means that you should never save this ID to file and only use it during the lifetime of the application. If you need an ID that will remain consistent after a reboot, then you should consider using the permanentId identifier instead, if available.
-- Called when a key event has been received. local function onKeyEvent( event ) -- Print the device's unique Android ID, if available. -- Note: The "device" property will be nil if the platform does not support input devices -- or if input came from software, such as a virtual keyboard. if event.device then print( "Android Device ID: " .. tostring( event.device.androidDeviceId ) ) end end -- Set up the above function to receive key events. Runtime:addEventListener( "key", onKeyEvent )