Android as rubber ducky
Using an Android device as a rubber ducky is possible, but setting it up can be difficult. Your device most likely doesn't work with the payload because it is not rooted and/or doesn't support HID keyboard output at kernel level. If there is no support for HID, this can be fixed by flashing a kernel which does support this, however the number of supported devices isn't exactly huge, meaning you would have to edit, compile and flash the kernel by yourself.

You can see the exact procedure here: https://github.com/plowsec/android-ducky

Here is a list of devices which already have compiled kernels (it is accessible from the first one, though): https://github.com/pelya/android-keyboard-gadget