When a user hold a Tango device the wrong way/blocks the device cameras, the OS displays following message:
"Nothing detected:
Keep the device at least an arm's length from object..."
Is it possible in the Unity Google Tango SDK to detect when this happens?
It's causing my app to become inaccurate and previously placed 3d objects appear at the wrong location.
It would be useful if this error could be handled in code, so the app can show a message to request the user to recalibrate to the app.
Related
I'm receiving reports from some of my users with the following exception
java.lang.IllegalArgumentException: getCameraCharacteristics:1019:
Unable to retrieve camera characteristics for unknown device 0: No
such file or directory (-2) at
android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1591)
at
android.hardware.camera2.CameraManager.getCameraCharacteristics(CameraManager.java:693)
This is of course doesn't make any sense, because we all know that the camera at "0" id should be available. And I have the info about cameras of a device being included to the report anyway:
Camera ID: 0 (selected), all [0, 2, 1, 3]
Cameras level: FULL, LIMITED, LIMITED, LIMITED
So it seems from time to time system thinks that such camera is not available and triggers this annoying exception.
One thing I can say that this issue only happened for Android 12...
UPDATE the issue seems to be related to this one Android camera recording is not working in background mode for some newest smartphones on Android 12
I have an app which records videos, it has about 80K current installations (more than 100K downloads), Crashlytics statistics seems to be good - Crash-free users 99.66% and rating on Google Play is also OK - 4.5
But still for some of my users can happen the next errors (it may happened for such user once or a couple of times by now, so not often, but still happens from time to time):
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:1578: Camera "0" disabled by policy
android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): Camera service is currently unavailable
java.lang.IllegalArgumentException: supportsCameraApi:2096: Unknown camera ID 0
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): validateClientPermissionsLocked:1066: Caller "com.MY_APP_PACKAGE" (PID 10237, UID 21433) cannot open camera "1" when sensor privacy is enabled
on opening camera using camera2 API:
...
cameraManager.openCamera(cameraId, stateCallback, mainHandler)`
} catch (e: Exception) {
e.printStackTrace()
openReportErrorDialog(e) // so a user could report this issue
...
Reported devices:
Vivo 1906
Wheatek BV5500Plus
Samsung SM-N975F
Samsung SM-G988W
Samsung SM-A520F
Motorola REVVLRY
HUAWEI VOG-L09
HUAWEI STK-LX1
HUAWEI MRD-LX1
HUAWEI FIG-LX1
Coolpad CP3669AS
Infinix X655C
Android versions: from 8 to 11 (app min SDK is 6)
So basically it can work fine for a specific user for some time, no issues when opening camera, but from time to time this exception can occur for such user
I don't have any idea why it happens. I can't reproduce this issue on my own devices (two Samsung, one Lenovo, one Huawei and one Xiaomi devices), only users can report such issue from time to time...
The most nonsense exception here is Unknown camera ID 0, because before opening camera I get list of available cameras, so it's not hardcoded, it's not possible that such camera id doesn't exist, and a user said that before this error that camera was working ok
UPDATE
Found this
https://developer.android.com/guide/components/foreground-services#bg-access-restrictions
So it seems if a foreground service was started by system (on BOOT_COMPLETED broadcast, declared in manifest) and not by app (if a user launch app) then it can't access camera and microphone.
So basically after rebooting a device we can't automatically start camera anymore without user interaction.
Really bad for dashboard camera applications for car drivers...
They added ACCESS_BACKGROUND_LOCATION, but there is no ACCESS_BACKGROUND_CAMERA and ACCESS_BACKGROUND_RECORD_AUDIO...
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:1578: Camera "0" disabled by policy
That either means the device has an enterprise policy installed that disables cameras for example (employers that don't want employees photographing stuff at work), or your app is trying to open the camera in the background, on more recent Android releases.
If it's the policy, there's nothing you can do besides to tell the user that there's a policy in place and to complain to their admins.
android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): Camera service is currently unavailable
java.lang.IllegalArgumentException: supportsCameraApi:2096: Unknown camera ID 0
These usually mean something has crashed in the camera stack - until things restart (takes a few seconds usually), all cameras will be reported as unknown.
Ideally that'll never happen, but bugs unfortunately exist even on the best devices. A retry a few seconds later will probably work, unless the camera hardware on the phone is failing in some way that leads to a persistent crash.
android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): validateClientPermissionsLocked:1066: Caller "com.MY_APP_PACKAGE" (PID 10237, UID 21433) cannot open camera "1" when sensor privacy is enabled
This means the OEM has some kind of 'shut off all cameras' feature like airplane mode is for radios. Like the enterprise policy above, this is something out of your control - the user needs to re-enable camera access, so all you can do is put up a dialog saying "cameras are disabled, sorry".
If your app targets Android 10 (API level 29) or higher and accesses location information in a foreground service, declare the location foreground service type as an attribute of your component.
<manifest>
...
<service ... android:foregroundServiceType="location|camera" />
At runtime, if the foreground service only needs access to a subset of the types declared in the manifest, you can limit the service's access using the logic in the following code snippet:
Notification notification = ...;
Service.startForeground(notification, FOREGROUND_SERVICE_TYPE_LOCATION| FOREGROUND_SERVICE_TYPE_CAMERA);
This is how you will be able to use camera in the background.
Since couple of weeks this exception appears sometimes on my App:
Non-fatal Exception: com.facebook.FacebookAuthorizationException: CONNECTION_FAILURE: TigonError(2): TigonLigerErrorDomain(2) AsyncSocketException: connect failed (immediately), type = Socket not open, errno = 101 (Network is unreachable)
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:218)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:173)
at com.facebook.internal.CallbackManagerImpl.onActivityResult(CallbackManagerImpl.java:95)
at com.myapp.util.connect.FacebookConnect.onActivityResult(FacebookConnect.java:338)
Facebook SDK: 4.27.0
Android version's impacted: 4.4.2 and 7 (Crashlytics informations)
Have you got some ideas guys about this exception?
Thank you very much
UPDATE
I wrote a ticket on Facebook support, and after several messages, the last is:
Hi Anthony, thanks for the additional details. Looking at the data for your app,
there don't seem to be any failed API calls logged for your app. This indicates
that the login attempts failed before they reached our servers, and confirms
that this was indeed due to network errors.
I agree that it's not the ideal experience for users to have to retry their
login attempt, but in the case of network-related issues like this, this is the
best approach. I would recommend prompting the user to check their device
connectivity and initialize the login flow again.
From debugging this, it's unlikely that this is due to compatibility issues with
Retrofit, though I can't rule it out with certainty. It's more likely that the
affected users simply experienced a temporary drop in connectivity.
I'll mark this as closed since there doesn't seem to be a bug within the
Facebook SDK, but if you're able to get any information that would indicate
otherwise (for example, a way to consistently reproduce the error on a device
that has full internet connectivity), please let me know and I'll be glad to
help look into this again.
This exception means that user of your app is experiencing problems with his Internet connection. It is a problem that all the developers should care when making network calls, but it is especially important for mobile devices (the quality of mobile internet can be significantly low). Unfortunately netwok errors cannot be eliminated completely.
The common way of solving such a problem is making retries: either on the side of the app (retrying, showing user an error only after several network errors), either on the side of the user (suggesting user to try once more).
Is there any way to get activities done by user from Android device like active time, inactive time, cyclic distance, steps count etc. without using “Google fit” api like M9 chip does in iPhone devices.
Somehow i found to get device activity by help of "Google APIs for Android" .Here you cannot get the proper count but can get the device activation mode.Please see below link
[https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity]
I'm creating an android application that interfaces with the texas instruments sensortag. One of the things the app needs to do is be able to change the frequency in which the temperature is reported to the app. I am able to change it through the official TI app which is great, but I cannot seem to get it working in my app.
When viewing the official app (iOS, can't run the android one?), it shows the temperature GATT service, which contains 3 characteristics. When I inspect the characteristics discovered by my app however, it only seems to find two - the data, and the notifications. Not the interval. I have attempted to construct this characteristic myself and write it however it doesn't do anything - no error, no success, just nothing.
The steps I've taken are essentially:
bluetoothGatt.discoverServices();
...
services = bluetoothGatt.getServices();
...
BluetoothGattService service = bluetoothGatt.getService(serviceUUID);
System.out.println("Characteristic = " + service.getCharacteristic(SensorTagGatt.UUID_IRT_PERI));
The output yields null. Is there something obvious I'm missing or that I should be doing that I might not be?
EDIT:
I've installed another app onto the phone written by another developer, and using this to inspect the services and characteristics available shows that it too is unable to find it, so I'm assuming there is something wrong with the android service discovery? The official iOS app is working as expected, and showing all characteristics. Unfortunately, the official android app seems to be incompatible with the version 1.5 firmware and crashes when trying to connect but I assume it too will fail to find the characteristic.
Has anyone else run into this issue and if so been able to get around it?