Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The more your Android device can recognize and manage external devices, the greater its range as an entertainment or even educational hub. Jelly Bean has added and enhanced a few key input device associations that make it possible for your device to have a more prominent role as a hub. Your app can now register to be notified if a particular input device, such as a new Joystick, is attached to the main unit. This input device awareness registration is handled by the InputManager.registerInputDeviceListener() method.
You can find more details about the InputManager and that particular method on the InputManager page that's found within the Hardware Input category of Android reference. Once your app knows that an input device has been added, it needs to know what that device can do. Now this functionality is handled by the InputDevice class, which was added in Jelly Bean. The InputDevice class can determine a wide range of device properties, including the source, so your app will know what kind of device is added, whether it's a trackball, gamepad, joystick, keyboard, or drawing stylus.
And then you can twirl down for even more definition. For example, if it's a keyboard, is it full alphabetic keyboard or partial non-alphabetic keyboard? And if it's a joystick or similar device, what can it process in terms of motion range, orientation, X and Y axes, pressure, size, or touch? You'll find all these particulars laid out on the InputDevice.html page found within the View category of Android reference.
Another input device-related capability that I want to discuss is a little bit esoteric I'll grant you, but it's pretty cool and surprisingly useful. I have become a big fan of the use of the vibrate feedback mechanism that's built into Android devices whenever you type a key or tap an icon. Now, if your input device supports vibration, like a game controller with rumble pack capabilities, you can detect that with the InputDevice.hasVibrator() method and then get that service with the InputDevice.getVibrator() method. Pretty cool.
These new capabilities go a long way towards broadening the appeal of Android apps that use external input devices. If you're in that camp, congratulations!
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98572 Viewers
61 Video lessons · 85861 Viewers
71 Video lessons · 69752 Viewers
56 Video lessons · 102059 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.