Bluetooth Remote & Mouse APP
The app is using the new Bluetooth HID API's to simulate an actual Bluetooth remote, with the support of D-PAD and Keyboard and mouse!
First pair with the TV or device in Android Bluetooth settings, then open the app and choose the paired device and click "Connect".
Note that the phone must have a gyroscope sensor to use the Air Mouse feature.
Source available here:
https://github.com/ahmedamoharram/bluetooth-remote