What is the difference between the following:
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
and
<uses-feature android:name="android.permission.CAMERA" android:required="false" />
Is the later even a valid declaration?
Is uses-feature only valid when associated with hardware components or even valid for system features?
Also, for every permission group is there a list of corresponding hardware components it uses, so that marking optional features would be easier ?
<uses-feature
android:name="string"
android:required=["true" | "false"]
android:glEsVersion="integer" />
Declares a single hardware or software feature that is used by the
application.
For more information read the documentation
Related
In my app i include a library that request camera. This limits my application for devices without camera and i need it specifically for a device with scanner but no camera. So i want to make the camera permission as not required in my app. How can i do this.
I added
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
in my apps manifest. Is that enough?
Or should i add tools:node="remove" or tools:node="replace" in my app like as below
<uses-permission android:name="android.permission.CAMERA" tools:node="replace" />
Yes it's enough. You set it to be a non-required feature, so it's non-required.
Just because you use the CAMERA permission doesn't mean the device has to have a camera. You could put in:
<uses-permission android:name="hue.com.derp" />
And it wouldn't restrict your compatibility base at all. If the host device doesn't recognize a permission, it ignores it.
The tools namespace has zero effect on runtime. It's simply for you to provide the IDE with a sample of what might happen during runtime, so it can update previews and the like.
I would say check the device type first if it has camera & 6.0+ then you need to ask for permission other wise just run your code normal
I'm trying to embed the Crosswalk runtime as a WebView replacement in an app with other Java code (i.e. not as a simple wrapper for a web app).
Now their official documentation says you need the following permissions in any case:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
This is a lot!
So I tried with fewer permissions. What I found is that the following permissions are really required in any case:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
This is okay. So if this was sufficient, it would be a significant improvement over the list given in the docs.
But maybe the others are required in some cases as well. Can someone clarify? In what situations are the other permissions needed? Only when some action is triggered via JavaScript? Then one may use Crosswalk without these, probably, right?
while you are correct about what the official documentation states, it's also true that there is some conflicting information on the crosswalk site.
Specifically, this link buried in the Cordova migration section:
Migrate using command line tools
suggests that:
Crosswalk requires a couple of extra permissions which are not inserted by the Cordova application generator.
and cites specifically:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Point is, cordova only adds
<uses-permission android:name="android.permission.INTERNET" />
and therefore one must derive that the only truly required permissions are:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
as you correctly concluded.
My guess is that the Crosswalk team added to the list the union of all permissions collectively needed by all features/extensions supported by the webview (which includes accessing the camera for WebRTC sessions).
In that regard, the list is appropriate (as quite similar to the ones other stand-alone browsers sport) and was possibly provided to cut short on the explanations.
Btw, I have made a test and removed the "CAMERA" permission from the manifest, and the webview handled the absence graciously (it didn't crash the application, the camera just stopped working and gave a black picture), which seems to point out that you can handle the webview to your users for generic browsing even with the limited set of permissions (but don't take my word on this: I just tried the camera!)
Hope this helps
I am mobile application developer and working on native as well as Phone Gap also.
I have build one application in Phonegap that work perfectly in device but not working in some of the tabs.
That i found here as per the Google Play Store policy. But why they are not showing a reason that due to some these kind of invalid code or due to some specific error which Google not allow you to run on some specific device.
Query 1 : I have Samsung Galaxy tab 2 and tab 3. My app is not working in both tablet as per the unsupported device availability list and when user search from tablets then they can't find app also in play store.
In my app i have set all requirements for all devices and tablets as below ,
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my_pkg" android:hardwareAccelerated="true" android:versionCode="6" android:versionName="1.5" android:windowSoftInputMode="adjustPan">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<application android:debuggable="false" android:hardwareAccelerated="true" android:icon="#drawable/ic_launcher" android:label="#string/app_name">
<receiver android:name="my_pkg.AlarmReceiver">
</receiver>
<receiver android:name="my_pkg.AlarmRestoreOnBoot">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity android:name="my_pkg.MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/app_name" android:theme="#android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
So, I am stuck here what is the issue with my app and why Google store is not allow to install my app in some of the device and tablet.
Before a week the total number of unsupported device & tablets are 1550 and now that are 1153.
Query 2 : How can i found the mistakes due to which i am not able to run my app in tablets and how to resolve it?.
Please Help me how to resolve this issue because without knowing the reason how can i solve it.
Finally after spending long time on RnD i have found solution. Actually i am not solo founder for this answer. I really thanks to all who had helped me to solve this issue.
Divesh Salian's answer is very near. I tried as per his instruction and along with that I have alter my config.xml file which have some unnecessary <features></features> tags.
I have asked my question in Samsung Developer form and also tried test my app in RTL but i was not able to login in web browser, don't know why ?
and finally I applied some other alternative regarding <uses-feature></uses-feature>
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.software.input_methods"
android:required="false" />
I have use above features but not going to filter app base on that so i have set android:required="false" for some specific features.
Care below things if you find this type of problem
How Google play filter the apps ?
Is your Uses-Feature are required ?
is your version code valid ?
Is your app compatible with all screen?
Have you added permission which are not required for your apps ?
I hope these links will solve your problem definitely.
Thanks to all again !!!
Try adding this in your manifest file, Previously it had worked for me
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
Well, in order to decipher the problem, create a Samsung Developers account and submit your app. Their engineers will test the app on different devices(phone and tablet) and give you a detailed report and a video of whatever issue they encounter while testing the app.
I'm sure it will solve your problem.
Try and run on the app via Android emulator and check the log cat for errors.
Secondly if the app was built with HTML5 and Javascript, try and validate the html tags and check your javascript functions.
Ensure you that have null values for some certain fields. Add console messages in your javascript functions to validate all the values the app needs.
Example:
function TestMe() {
var a1 = document.getElementById("textboxname").value;
console.log(a1); //this line is to show that you don't have a null value.
}
</script>
Yesterday I released my app and realised that it is not available for my android 2.3.3 device. (Does not get listet in search results, and when I access the app page directly, android market tells me that it is not available for my device).
The lines of my manifest, which could be the issue (IMO) look like that:
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="8" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-feature android:name="android.hardware.camera.autofocus" />
The only thing I can think of which could make a difference is that I have no SIM card inserted on that phone- but I have Wifi access. (will try it with SIM card in the evening)
Any ideas?
Application requires autofocus camera unless you add `android:required="false" to the use-feature tag.
From documentation, see last if statement:
Filtering based on explicitly declared features
An explicitly declared feature is one that your application declares in a element. The feature declaration can include an android:required=["true" | "false"] attribute (if you are compiling against API level 5 or higher), which lets you specify whether the application absolutely requires the feature and cannot function properly without it ("true"), or whether the application prefers to use the feature if available, but is designed to run without it ("false").
Android Market handles explicitly declared features in this way:
If a feature is explicitly declared as being required, Android Market adds the feature to the list of required features for the application. It then filters the application from users on devices that do not provide that feature. For example:
<uses-feature android:name="android.hardware.camera" android:required="true" />
If a feature is explicitly declared as not being required, Android Market does not add the feature to the list of required features. For that reason, an explicitly declared non-required feature is never considered when filtering the application. Even if the device does not provide the declared feature, Android Market will still consider the application compatible with the device and will show it to the user, unless other filtering rules apply. For example:
<uses-feature android:name="android.hardware.camera" android:required="false" />
If a feature is explicitly declared, but without an android:required attribute, Android Market assumes that the feature is required and sets up filtering on it.
The minSdkVersion="7" and targetSdkVersion="8" but you device is 2.3.3 which equal sdk version 10
This will help you to know the sdk versions
so change the versions range in your manafist file
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="7" android:maxSdkVersion="10" />
I've been working on an app that originally had no touchscreen requirements specified in it's manifest file, so according to the documentation android.hardware.touchscreen is assumed. Because the app doesn't require advanced gestures, a device with a faketouch screen (android.hardware.faketouch) should also be able to run the app, so I added that requirement to the manifest file for an update.
However, the Android market still lists android.hardware.touchscreen as a requirement (as well as android.hardware.faketouch), and I still can't find the updated app in the market on a faketouch device (HTC Wildfire).
These are the permissions, requirements and libraries I specified:
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.faketouch" />
<uses-sdk android:minSdkVersion="4"></uses-sdk>
Is this a problem (perhaps the market remembers old requirements, or perhaps the Google Maps library inserts a touchscreen requirement) or is it normal to see both listed when specifying faketouch?
It might be too late but might help someone else looking for same problem
If you want the touchscreen feature to be optional add this to manifest:-
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
otherwise it is implicitly taking touchscreen as required compulsarily based on some of your code