I am working on Pan frame 360 degree video Android SDK and would like to navigate around the video using 'Motion' mode (using gyroscope). It is described in the documentation. But, I was not able to get that working. Do I need to enable any specific permission. I was able to navigate the video using 'Touch'.
check if your device support gyroscope with supportedNavigationMode function. see sdk docs
Firstly, this is what i added into my manifest file
<manifes>
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true" />
</mainfest>
But for me the problem was that both the phone and tablet in which I tested app do not have gyroscope. (only accelerometer). So if this is the case for you check if your devise has gyroscope. Tested on Galaxy 5s, it worked.
EDIT: To check if my devise has gyroscope or not I just looked at devise specification on the internet, and that's it.
Related
Hi
I created a camera app and set few <uses-feature> 's and one of them was android.hardware.Camera (Deprecated). I tried to send my APK, but Google decided to put "Supported Devices" to 0. I tried to do the same with android.hardware.camera2, but the result was the same; no supported devices.
What causes this?
You added:
<uses-feature android:name="android.hardware.camera" />
But you'll also need:
<uses-permission android:name="android.permission.CAMERA" />
And maybe also:
<uses-feature android:name="android.hardware.camera.autofocus" />
Check https://developer.android.com/guide/topics/media/camera.html and https://developer.android.com/reference/android/hardware/Camera.html for all requirements
Please note that there's no automatic mapping between Android API packages (like android.hardware.camera2 package or the class android.hardware.Camera) and Android features such as FEATURE_CAMERA.
And the features have to have exactly matching strings - saying you require feature "android.hardware.Camera" is not the same as "android.hardware.camera". The latter is the value of FEATURE_CAMERA, and the former doesn't exist in the official SDK. If you ask for it, you'll match no devices since no device lists that feature.
Similarly, there's no separate feature for the new camera2 API - if a device has a camera, it'll support camera2 on some level. So just requiring FEATURE_CAMERA is enough. If you need a highly capable camera device, such as the FULL-level camera2 implementation, then you might want FEATURE_CAMERA_LEVEL_FULL.
But listing features doesn't enable you to use them - all it does is restrict what devices your app is compatible with. You can use the camera API whether or not you list FEATURE_CAMERA (though you will need the permission, as Raymond de la Croix points out).
I have an app ready to go that requires that there be a rear facing camera. Obviously it has the <uses-permission android:name="android.permission.CAMERA" /> permission in the manifest but this does not rule out devices such as the Nexus 7 tablet which has only a front facing camera.
Short of going through and manually excluding the devices how can I do this?
I only know of a programmatical answer.
As this question indicates, you can use
PackageManager pm = context.getPackageManager();
return pm.hasSystemFeature(PackageManager.FEATURE_CAMERA);
This returns false if the device has no back facing camera (so false on the Nexus 7)
the flag
FEATURE_CAMERA_FRONT
will still be true instead. So you can use this test on launch of your first activity, along with a big warning in your app description.
However, I don't know of a way to use the manifest to exclude the devices on this criteria, short of manually excluding devices.
Edit: another question linked as related points out this uses-feature flag for the manifest:
<uses-feature android:name="android.hardware.camera" android:required="false"/>
According to the docs:
The application uses the device's camera. If the device supports multiple cameras, the application uses the camera that facing away from the screen.
So it's a bit ambiguous for front-facing only devices.
You can Use uses-feature tag given inandroid. You have to declare this tag in manifest file. It automatically filter the device based on given condtion. Just use this uses-feature tag in manifest like this:
<uses-feature android:name="android.hardware.camera" android:required="true" />
For more detail follow the following links:-
Android Uses Premission
My app needs a Camera to work. However, it doesn't matter if it's a rear or frontal camera.
Right now, I have this in my Manifest:
<uses-feature android:name="android.hardware.camera"/>
To require a frontal Camera, I know I could also add this:
<uses-feature android:name="android.hardware.camera.front"/>
But I'd like to support all devices that has EITHER camera. Is there anyway to do this?
For example, I want to support Nexus 7 which has only a frontal camera. But I also want to support devices with rear camera only.
According to some research I've made, such as:
http://code.google.com/p/android/issues/detail?id=35166
It seems this is not possible.
I think one way to solve this would be to make 2 separate APKs, one with android.hardware.camera and one with android.hardware.camera.front and upload both to Google Play, using its Multiple APK Support. I haven't tested it yet, though.
Has anybody found a recommended way to support all devices with a frontal camera, a rear camera or both, but not devices without any cameras?
Several thoughts (no definite answer):
a) I believe you are right that currently there is no good way to require either camera in on APK.
b) If you want, you can remove uses-feature and check for a camera in runtime. It will make user experience worse, but it will work.
c) You can use use required="false" (http://developer.android.com/guide/topics/manifest/uses-feature-element.html). Hopefully, Google Market prioritize applications using this flag.
c) Side note. As I know most of Android devices have a camera. So, if you go with solution b) or c) only very small user base will notice the difference
This has changed since it was answered, you can now add the uses-feature to the manifest that requires any camera like this:
<uses-feature android:name="android.hardware.camera.any" android:required="true" />
Just to add my 2 cents to this discussion:
I achieved the same result as #Cat described in comment to Juan Cortes.
The way I tested this was using aapt (instructions on testing found in http://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions-features ) , and looking for explicit or implicit camera requirements:
No <uses-feature> flag, but requiring camera permission:
Observe the uses-implied-feature
Using only <uses-feature android:name="android.hardware.camera.any" android:required="false" />:
Still implying that the app ALWAYS needs a camera.
both <uses-feature android:name="android.hardware.camera.any" android:required="false" /><uses-feature android:name="android.hardware.camera" android:required="false" /> defined:
No more implied features.
Hope this helps somebody profile their own app.
I'm trying to figure out is there a way to let my app runs on devices with front camera only. Well, I think I should make it through <uses-feature> in AnrdoidManifest.xml.
I made it like that:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera.front" android:required="true"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
but it doesn't help. I mean I can run it on my device without front-facing camera. But maybe this features don't let users to download an app if their device doesn't have such feature?
If I'm wrong, please tell me the right way to solve my problem.
Regards, Dmitriy.
The users won't be able to download it from the Android Market if they don't have a front camera thanks to the uses-feature. So don't worry about that.
Now, in case someone "steals" your apk, then you can check this link to see how you programmatically check for a front camera.
I'm developing an android app and need either the hardware feature android.hardware.camera.flash or android.hardware.camera.front. I want to assure that this app will be available for smartphones which have flashlight but no facing front camera. How can I achieve this?
Thanks in advance
I do not believe there is a way of expressly putting in an "either-or" constraint. You could add android:required="false" for both <uses-feature> elements, but then you will get devices that lack both features.
I want to assure that this app will be available for smartphones which have flashlight but no facing front camera.
Have android:required="true" on the android.hardware.camera.flash feature and android:required="false" on the android.hardware.camera.front feature.