How to use an Xbox one controller with an android device?

While connecting an Xbox one controller to a Windows PC via USB works fine after downloading the respective driver, I was wondering how to use it on an android device via USB OTG, or to an OUYA.
Best Answer
With Android 4.0
or higher and a wired
controller it's just a Plug&Play via the USB OTG.
However there are games/mobile phone which aren't compatible for USB OTG.
To find out whether your mobile phone is, just google your mobile phone and add OTG.
To find out whether a game is compatible there is an app from NVIDIA (should be installable for any android device 4.0+) which checks the compatibility.
Pictures about "How to use an Xbox one controller with an android device?"



Quick Answer about "How to use an Xbox one controller with an android device?"
Can you use Xbox One controller on Android?
With the release of the Xbox One S, Microsoft started outfitting its Xbox One controllers with Bluetooth radios. While this feature was made mostly for PC gaming, you'll be happy to know that it works surprisingly well with Android phones and their games.How do I connect my Xbox One controller to my Android wirelessly?
Connect Xbox One Controller to AndroidHow to Connect Xbox One Controller to Android Phone using BLUETOOTH (Easy Method)
More answers regarding how to use an Xbox one controller with an android device?
Answer 2
It is possible to use the controller via USB OTG, but your device MUST be rooted and it may be difficult.
First of all check your X1 controller DeviceId, on Windows you can do it through Device Manager: Device Manager -> Xbox Controller -> Properties -> Details -> Hardware Ids
VID should be 0x45e
PID will be either 0x2d1 or 0x2dd
Easy method for older controllers (0x2d1)
If you are running a ROM based on Linux kernel 3.18, then the controller will work out of the box! So you might want to flash a new ROM/Kernel if it's very important to you... This is probably the easiest solution.
Otherwise, You can probably make the controller work with the "USBBT Joystick Center GOLD" application which you can get here. Just follow this Youtube video and it SHOULD work if you're lucky :)
Hard method for newer controllers (0x2dd)
If the above didn't work or you have the new controller, and you're not shy about recompiling the Android kernel, you can:
A. Download the Android kernel sources for you device (see instructions h-ttps://source.android.com/source/building-kernels.html)
B. In the kernel sources, replace the file xpad.c under /drivers/input/joystick/ with the newest sources from here: h-ttps://github.com/paroj/xpad
C. Rebuild the whole kernel and replace your boot image, or just build xpad as a kernel module and load it using insmod from the adb shell
GOOD LUCK!
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Bruno Henrique, thiago japyassu, thiago japyassu, Yurii Hlei