Gamepad Support

I have been looking into Gampad support (HID gamepads specifically) and have been having trouble with getting all the events to fire with Unity.

On the Java layer I’d expect the following functions to fire on the base activity.
-onKeyDown
-onKeyUp
-onGenericMotionEvent

This works great in a native android app however when I tweak our root activities to be something even as simple as and launch an app theonGenericMotionEvent function is never called. However if I leave the app and come back it then will fire as expected.

       @Override
        public boolean onGenericMotionEvent(MotionEvent event) {
              FLAPLog.err(FLAPUnityActivity.class, "OnGenericMotion:");
               return true;
              // TODO Auto-generated method stub
              //return super.onGenericMotionEvent(event);
       }

I cannot find a cause for this to work after resuming the app but not on a fresh launch was hoping anyone here would.

same problem,onGenericMotionEvent never called.

By calling below two methods in your view initialization resolve the issue.
setFocusable(true);
setFocusableInTouchMode(true);

Call these methods while initializing your view :
setFocusable(true);
setFocusableInTouchMode(true);