Declaring Features

Your camera implementation works great now. One more task remains: tell potential users about it. When your app uses a feature like the camera, or NFC, or any other feature that may vary from device to device, it is strongly recommended that you tell Android about it. This allows other apps (like the Google Play store) to refuse to install your app if it uses a feature the device does not support.

To declare that you use the camera, add a <uses-feature> tag to your AndroidManifest.xml:

Listing 16.11  Adding uses-feature tag (AndroidManifest.xml)

<​?​x​m​l​ ​v​e​r​s​i​o​n​=​"​1​.​0​"​ ​e​n​c​o​d​i​n​g​=​"​u​t​f​-​8​"​?​>​ <​m​a​n​i​f​e​s​t​ ​x​m​l​n​s​:​a​n​d​r​o​i​d​=​"​h​t​t​p​:​/​/​s​c​h​e​m​a​s​.​a​n​d​r​o​i​d​.​c​o​m​/​a​p​k​/​r​e​s​/​a​n​d​r​o​i​d​"​ ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.