Wednesday, July 25, 2012

The 5 steps to future hardware happiness Specify a uses-feature node for every API feature used by your app. This forces you to think about what your app uses, allowing you to: Decide which features are necessary for your app to be useful and mark those featured with the attribute required=true. This lets Market hide your app from any device that doesn’t support the hardware features your app requires. For features that aren’t strictly required, set required=false. Then go in to your code and find where you have used the optional features. Use the hasSystemFeature method from the PackageManager to determine if the hardware is available and provide alternative paths for your code as appropriate. PackageManager pm = getPackageManager(); boolean hasCompass = pm.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS); Now you can sleep soundly in the knowledge that no matter what variation in Android compatible hardware comes to market, your app will always (and only) be available on those it supports. You can find more details on how the Android Market uses filters to determine whether to show your application to a user who is browsing or searching for applications on a given device at the Market Filters page on the Android Developer Site.

No comments: