[android-developers] Re: Where do we use uses-feature android:required="false"?

2016-06-10 Thread Ke Ning
Happen to see this old post, I have a similar question along this line. 

If my app do NOT need camera permission, and I am just throwing intent to 
let the camera app to capture a picture and return to my app, then 
theoretically I don't need to declare any  or  
in my manifest. But, if I do declare a , that 
seems to be identical to not declaring it at all, is this correct?

On Saturday, November 26, 2011 at 9:12:51 AM UTC-5, limtc wrote:
>
> I see. Thanks for the explanation!
>
> So if I don't declare it, based on the table, it will assume I uses
> features:
>
> android.hardware.camera and
> android.hardware.camera.autofocus
>
> So in order for me to show the app in Android Market that does not
> support camera (like low end camera-less tablets), I will need:
>
>  android:required="false" />
>
> I am not too sure whether I need to declare or not? Since autofocus is
> often unnecessary for many apps.
>
>  android:required="false" />
>
> On 11月26日, 下午8时45分, Mark Murphy  wrote:
>
> > 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-eleme...
> >
> > "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  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  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/commonsguyhttp://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 unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/f15e2f2d-cba1-4f1b-9e73-32ab9c0624aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-27 Thread lbendlin
This may be a dumb question but why do you need the uses-feature  in the 
first place? In my app I make use of the camera if one is available, and 
similar to the OP I hide the related UI elements if not. This works fine on 
all devices.  I am compiling against SDK 8 with target SDK 3. Hhas the 
uses-feature  become mandatory in later SDKs?

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

Re: [android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-27 Thread Jovish P
I think your app won't be visible in androiid market who is using mobile
phone doesn't have camera, assuming that camera is needed for your app to
work if you are not using uses feature. If your app  work even without
camera , then you have to use  uses-feature required= false to avoid the
filtering  by android market. Execuse for my english .. It
is not mandatory to include uses-feature. If you have enough time please
go through the link i posted in this message. everything is mentioned very
clearly there..



On Sun, Nov 27, 2011 at 6:42 PM, lbendlin l...@bendlin.us wrote:

 This may be a dumb question but why do you need the uses-feature  in the
 first place? In my app I make use of the camera if one is available, and
 similar to the OP I hide the related UI elements if not. This works fine on
 all devices.  I am compiling against SDK 8 with target SDK 3. Hhas the
 uses-feature  become mandatory in later SDKs?

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


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

Re: [android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-27 Thread lbendlin
ah, that's why. The devices without camera that use our program also don't 
have access to the market, so we distribute our apk directly to them (and 
don't suffer from the market filter). thanks for the clarification.

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

Re: [android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-27 Thread Mark Murphy
On Sun, Nov 27, 2011 at 9:27 AM, lbendlin l...@bendlin.us wrote:
 ah, that's why. The devices without camera that use our program also don't
 have access to the market, so we distribute our apk directly to them (and
 don't suffer from the market filter). thanks for the clarification.

There are devices accessing the Android Market that lack cameras and
more to come. Long-term, Google TV may be the biggest one. I wouldn't
be surprised if we see tablets with Kindle Fire-ish camera-less specs
but Android Market access show up eventually too.

But I'm fairly certain there are some low-end phones sans cameras
today that use the Market. Leastways, there used to be, back in the
Android 1.x days.

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

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.1
Available!

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


[android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread limtc
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.

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.

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.

But if this is true, isn't 1) and 3) the same? That's why I am
confused. Thanks for any clarification.

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


Re: [android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread Mark Murphy
On Sat, Nov 26, 2011 at 7:24 AM, limtc thyech...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread limtc
I see. Thanks for the explanation!

So if I don't declare it, based on the table, it will assume I uses
features:

android.hardware.camera and
android.hardware.camera.autofocus

So in order for me to show the app in Android Market that does not
support camera (like low end camera-less tablets), I will need:

uses-feature android:name=android.hardware.camera
android:required=false /

I am not too sure whether I need to declare or not? Since autofocus is
often unnecessary for many apps.

uses-feature android:name=android.hardware.camera.autofocus
android:required=false /

On 11月26日, 下午8时45分, Mark Murphy mmur...@commonsware.com wrote:

 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-eleme...

 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/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread Mark Murphy
On Sat, Nov 26, 2011 at 9:12 AM, limtc thyech...@gmail.com wrote:
 I am not too sure whether I need to declare or not? Since autofocus is
 often unnecessary for many apps.

 uses-feature android:name=android.hardware.camera.autofocus
 android:required=false /

AFAIK, if you do not require a camera, you do not require an autofocus camera.

-- 
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread limtc
Yes, I know. Since the default is true, that means I need to declare
to declare autofocus to false too.

On 11月26日, 下午11时14分, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Nov 26, 2011 at 9:12 AM, limtc thyech...@gmail.com wrote:
  I am not too sure whether I need to declare or not? Since autofocus is
  often unnecessary for many apps.

  uses-feature android:name=android.hardware.camera.autofocus
  android:required=false /

 AFAIK, if you do not require a camera, you do not require an autofocus camera.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Where do we use uses-feature android:required=false?

2011-11-26 Thread limtc
What I mean is that since the assumption is both features are true, to
switch it off probably need to set both to false:

uses-feature android:name=android.hardware.camera
android:required=false /
uses-feature android:name=android.hardware.camera.autofocus
android:required=false /

I believe many developers will not declare the camera.autofucus to
false.

On 11月26日, 下午11时14分, Mark Murphy mmur...@commonsware.com wrote:
 On Sat, Nov 26, 2011 at 9:12 AM, limtc thyech...@gmail.com wrote:
  I am not too sure whether I need to declare or not? Since autofocus is
  often unnecessary for many apps.

  uses-feature android:name=android.hardware.camera.autofocus
  android:required=false /

 AFAIK, if you do not require a camera, you do not require an autofocus camera.

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en