Detect Amazon Fire tv remote control

I’m trying to build a streaming App for Android and Fire Tv.

Is there a way to detect Amazon Fire tv remote control events?

especially detect if play, previous or next are pressed.