Some Androids (E.g. HUAWEI) cannot properly wait for camera permissions
See original GitHub issuePlugin Version or Commit ID
v0.10.3
Unity Version
2021.3.4f1
Your Host OS
win11
Target Platform
Android
Target Device
No response
[Windows Only] Visual Studio C++ and Windows SDK Version
No response
[Linux Only] GCC/G++ and GLIBC Version
No response
[Android Only] Android Build Tools and NDK Version
No response
[iOS Only] XCode Version
No response
Build Command
python build.py build --android arm64 --android_ndk_api_level 21 -vv
Bug Description
Open the apk for the first installation,it doesn’t work It works the second time you open it I think “Callback RequestUserPermission” should be used
https://docs.unity3d.com/ScriptReference/Android.Permission.RequestUserPermission.html
#if UNITY_ANDROID
if (!Permission.HasUserAuthorizedPermission(Permission.Camera))
{
+ bool permissionResponse = false;
+ var callbacks = new PermissionCallbacks();
+ callbacks.PermissionDenied += (string permissionName) => { permissionResponse = true; };
+ callbacks.PermissionGranted += (string permissionName) => { permissionResponse = true; };
+ callbacks.PermissionDeniedAndDontAskAgain += (string permissionName) => { permissionResponse = true; };
+ Permission.RequestUserPermission(Permission.Camera, callbacks);
+ yield return new WaitUntil(() => permissionResponse);
- Permission.RequestUserPermission(Permission.Camera);
- yield return new WaitForSeconds(0.1f);
}
#elif UNITY_IOS
Steps to Reproduce the Bug
open apk
Log
no log
Screenshot/Video
No response
Additional Context
No response
Issue Analytics
- State:
- Created 8 months ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Android: Permission Denial: starting Intent with revoked ...
1- Go to Settings of your emulator. 2- Look for Apps and Notifications. 3- Click on Add Permission. see the pic : https://i.stack.imgur....
Read more >How to Fix "Can't Connect to the Camera" Issue
Tap and hold the Power Off option for a couple of seconds then confirm that you want to go on Reboot to Safe...
Read more >[camera] Huawei devices running Android 7/8 throw ...
Getting this error when taking picture with both front and rear camera on Huawei Mate 10 Lite. I was hoping that Camera 0.9.0...
Read more >Change app permissions on your Android phone
To change a permission setting, tap it, then choose Allow or Don't allow. For location, camera, and microphone permissions, you may be able...
Read more >Find the Normal Mode images using Huawei Camera ...
Introduction In this article, we can learn about the Normal Mode type images captured by Huawei Camera Engine. This mode supports the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://user-images.githubusercontent.com/17309378/212228720-8e3bb10a-4e1a-4129-bde0-a3676a4b2ba2.mp4
log.txt
i add debug log in script “Start RequestUserPermission” “End RequestUserPermission”
After my testing this submission does not solve this problem