On Sat, Nov 26, 2011 at 7:24 AM, limtc <[email protected]> wrote:
> Oh, so is this summary correct? Assuming the app requested a CAMERA
> permission.
>
> 1) Do not declare <uses-feature>
> - Android Market will NOT show app to devices without camera.

Correct. Ideally, you'd still put in <uses-feature> with required=true
for documentation purposes, but it is not necessary.

> 2) Use <uses-feature android:name="android.hardware.camera"
> android:required="false" />
> - Android Market will show the app to all devices with or without
> camera.

Correct. You can use PackageManager and hasSystemFeature() to
determine whether the device has a camera at runtime.

> 3) Use <uses-feature android:name="android.hardware.camera"
> android:required="true" />
> - Android Market will need the camera feature to be there, and will
> NOT show app to devices without camera.

Correct.

> But if this is true, isn't 1) and 3) the same?

1) delivers the same results as 3) due to a side-effect of requiring
that permission.

http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions

"Some feature constants listed in the tables above were made available
to applications after the corresponding API; for example, the
android.hardware.bluetooth feature was added in Android 2.2 (API level
8), but the bluetooth API that it refers to was added in Android 2.0
(API level 5). Because of this, some apps were able to use the API
before they had the ability to declare that they require the API via
the <uses-feature> system.

"To prevent those apps from being made available unintentionally,
Android Market assumes that certain hardware-related permissions
indicate that the underlying hardware features are required by
default. For instance, applications that use Bluetooth must request
the BLUETOOTH permission in a <uses-permission> element — for legacy
apps, Android Market assumes that the permission declaration means
that the underlying android.hardware.bluetooth feature is required by
the application and sets up filtering based on that feature."

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to