Something seems to be missing where the app requests camera recording access.
In one app, built from scratch, everything works as expected, but, when I integrate Vuforia into my current project, Vuforia is not running and there is no camera permissions request and no green camera icon on-screen.
Is there a setting or requirement I might be missing?
I have compared most all project settings in Unity, Android Manifest, render settings, etc. and made them match between the two projects.
I can provide more information if needed.
Thanks,
-Ryan Favale
Hi Ryan, thank you for your post. Here's a great integration guide to check all the necessary steps required as a starting point. Please let me know if this helps.
Thanks, I almost have this page memorized actually. Been through it about a dozen times now.
@ryan.favale , can you send us a bug report to help us with debugging this? We will also need screenshots and detailed accounts of symptoms.
0001/01/01 00:00:00.000 -1 -1 Info --------- beginning of main
2023/02/03 23:01:50.761 15938 15938 Error ented.associat Not starting debugger since process cannot load the jdwp agent.
2023/02/03 23:01:50.825 15938 15938 Info IL2CPP JNI_OnLoad
2023/02/03 23:01:50.863 15938 15960 Info Unity MemoryManager: Using 'Dynamic Heap' Allocator.
2023/02/03 23:01:50.872 15938 15960 Info Unity SystemInfo CPU = x86-64 SSE3 SSE4.1 SSE4.2 AVX, Cores = 8, Memory = 8827mb
2023/02/03 23:01:50.872 15938 15960 Info Unity ApplicationInfo com.lil.augmented.associate version 1.0
2023/02/03 23:01:50.872 15938 15960 Info Unity Built from '2022.2/staging' branch, Version '2022.2.0b8 (9eb452e2ea43)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'x86_64', Stripping 'Enabled'
2023/02/03 23:01:51.109 15938 15960 Error libprocessgroup set_timerslack_ns write failed: Operation not permitted
2023/02/03 23:01:51.111 15938 15960 Info chatty uid=10134(com.lil.augmented.associate) UnityMain identical 14 lines
2023/02/03 23:01:51.111 15938 15960 Error libprocessgroup set_timerslack_ns write failed: Operation not permitted
2023/02/03 23:01:51.119 15938 15960 Info Unity Vulkan interception succeeded
2023/02/03 23:01:51.120 15938 15960 Info Unity Retrieved function pointers for atrace successfully
2023/02/03 23:01:51.120 15938 15960 Info Unity Registered profiler callbacks successfully
2023/02/03 23:01:51.121 15938 15960 Info Unity Company Name: Lowe's Innovation Labs
2023/02/03 23:01:51.121 15938 15960 Info Unity Product Name: Lowe's Augmented Associate
2023/02/03 23:01:51.130 15938 15960 Debug vulkan searching for layers in '/system/lib64'
2023/02/03 23:01:51.134 15938 15960 Debug vulkan added global layer 'VK_LAYER_MAGICLEAP_dirty_tile_map' from library '/system/lib64/libVkLayer_MAGICLEAP_dirty_tile_map.so'
2023/02/03 23:01:51.142 15938 15960 Debug vulkan added global layer 'VK_LAYER_KHRONOS_validation' from library '/system/lib64/libVkLayer_khronos_validation.so'
2023/02/03 23:01:51.144 15938 15960 Debug vulkan searching for layers in '/data/app/com.lil.augmented.associate-0B1B4IDszEtQOJcIvn3-Pg==/lib/x86_64'
2023/02/03 23:01:51.144 15938 15960 Debug vulkan searching for layers in '/data/app/com.lil.augmented.associate-0B1B4IDszEtQOJcIvn3-Pg==/base.apk!/lib/x86_64'
2023/02/03 23:01:51.147 15938 15960 Info vulkan Loaded layer VK_LAYER_MAGICLEAP_dirty_tile_map
2023/02/03 23:01:51.167 15938 15938 Warn UnityMain type=1400 audit(0.0:8634): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:51.167 15938 15938 Info chatty uid=10134(com.lil.augmented.associate) identical 5 lines
2023/02/03 23:01:51.167 15938 15938 Warn UnityMain type=1400 audit(0.0:8640): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:51.184 15938 15960 Error vulkan internal vkGetInstanceProcAddr called for vkEnumerateInstanceExtensionProperties with an instance
2023/02/03 23:01:51.185 15938 15960 Info Unity [XR] [XRPreInit]: Telling EGL/Vulkan to use the offscreen swapchain!
2023/02/03 23:01:51.185 15938 15960 Info vulkan Loaded layer VK_LAYER_MAGICLEAP_dirty_tile_map
2023/02/03 23:01:51.195 15938 15960 Error vulkan internal vkGetInstanceProcAddr called for vkEnumerateInstanceExtensionProperties with an instance
2023/02/03 23:01:51.228 15938 15960 Warn Android_FMOD_MLAudio OutputMLAudio::getDescriptionEx, ...
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack Format:
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack samples_per_second=24000
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack channel_count=2
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack bits_per_sample=16
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack valid_bits_per_sample=16
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack sample_format=0
2023/02/03 23:01:51.231 15938 16026 Info AudioTrack channel_format=0
2023/02/03 23:01:51.233 15938 16026 Warn AudioTrack Use of stream types is deprecated for operations other than volume control
2023/02/03 23:01:51.233 15938 16026 Warn AudioTrack See the documentation of AudioTrack() for what to use instead with android.media.AudioAttributes to qualify your playback use case
2023/02/03 23:01:51.331 15938 15960 Warn Unity The referenced script (Unknown) on this Behaviour is missing!
2023/02/03 23:01:51.332 15938 15960 Warn Unity The referenced script on this Behaviour (Game Object '') is missing!
2023/02/03 23:01:51.356 15938 15960 Info Unity XRGeneral Settings awakening...
2023/02/03 23:01:51.356 15938 15960 Info Unity UnityEngine.XR.Management.XRGeneralSettings:Awake()
2023/02/03 23:01:51.356 15938 15960 Info Unity
2023/02/03 23:01:51.360 15938 15960 Info IL2CPP Locale en-US
2023/02/03 23:01:51.401 15938 15960 Info Unity Setting loading lib path in xr package
2023/02/03 23:01:51.413 15938 15960 Warn Unity [XR] Adding ptr for typeid 130108415719168
2023/02/03 23:01:51.413 15938 15960 Info Unity [XR] Loading dll from path libperception.magicleap.so
2023/02/03 23:01:51.487 15938 15960 Warn Unity [XR] Adding ptr for typeid 130108415719232
2023/02/03 23:01:51.487 15938 15960 Info Unity [XR] Loading dll from path libgraphics.magicleap.so
2023/02/03 23:01:51.489 15938 15960 Verbose OpenXR-Loader Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader trampoline
2023/02/03 23:01:51.489 15938 15960 Info OpenXR-Loader Info [GENERAL | | OpenXR-Loader] : RuntimeManifestFile::FindManifestFiles - using global runtime file /system/etc/openxr/1/active_runtime.json
2023/02/03 23:01:51.489 15938 15960 Info OpenXR-Loader Info [GENERAL | | OpenXR-Loader] : RuntimeManifestFile::CreateIfValid - attempting to load /system/etc/openxr/1/active_runtime.json
2023/02/03 23:01:51.492 15938 15960 Info OpenXR-Loader Info [GENERAL | xrCreateInstance | OpenXR-Loader] : RuntimeInterface::LoadRuntime succeeded loading runtime defined in manifest file /system/etc/openxr/1/active_runtime.json using interface version 1 and OpenXR API version 1.0
2023/02/03 23:01:51.492 15938 15960 Verbose OpenXR-Loader Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering LoaderInstance::CreateInstance
2023/02/03 23:01:51.492 15938 15960 Verbose OpenXR-Loader Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Entering loader terminator
2023/02/03 23:01:51.493 15938 15960 Verbose OpenXR-Loader Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Completed loader terminator
2023/02/03 23:01:51.494 15938 15960 Info OpenXR-Loader Info [GENERAL | xrCreateInstance | OpenXR-Loader] : LoaderInstance::CreateInstance succeeded with 0 layers enabled and runtime interface - created instance = 0x00007655d1c22000
2023/02/03 23:01:51.494 15938 15960 Verbose OpenXR-Loader Verbose [GENERAL | xrCreateInstance | OpenXR-Loader] : Completed loader trampoline
2023/02/03 23:01:51.908 15938 15960 Info Unity [XR] [XR::Display] Initializing RenderTextures with yflip blit set to 'true'
2023/02/03 23:01:51.921 15938 15960 Verbose MediaRouter Selecting route: RouteInfo{ name=Phone, description=null, status=null, category=RouteCategory{ name=System types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
2023/02/03 23:01:51.930 15938 15960 Info Input6DofFilter input_6dof_filter.cpp:92: Input6DofFilter was created
2023/02/03 23:01:51.930 15938 15960 Info Input6DofFilter input_6dof_filter.cpp:92: Input6DofFilter was created
2023/02/03 23:01:51.930 15938 15960 Warn Unity [XR] Adding ptr for typeid 130108415719360
2023/02/03 23:01:51.930 15938 15960 Info Unity [XR] Loading dll from path libinput.magicleap.so
2023/02/03 23:01:51.932 15938 15960 Info ml_input ml_input.cpp:1362: At application start, found controller device 257, type 1, registered as index 0
2023/02/03 23:01:51.991 15938 15960 Warn Unity [XR] Adding ptr for typeid 130108415720512
2023/02/03 23:01:51.991 15938 15960 Info Unity [XR] Loading dll from path libUnityMagicLeap.so
2023/02/03 23:01:51.992 15938 15960 Warn Unity The Camera's near clipping plane was set to a value that's beneath hardware limitations. Setting value to:0.3703704
2023/02/03 23:01:51.992 15938 15960 Warn Unity UnityEngine.XR.MagicLeap.Rendering.CameraEnforcement:EnforceCameraProperties()
2023/02/03 23:01:51.992 15938 15960 Warn Unity UnityEngine.BeforeRenderHelper:Invoke()
2023/02/03 23:01:51.992 15938 15960 Warn Unity
2023/02/03 23:01:52.179 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9023): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:52.179 15938 15938 Info chatty uid=10134(com.lil.augmented.associate) identical 3 lines
2023/02/03 23:01:52.179 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9027): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:52.457 15938 16024 Info Unity [XR] [XR::Display] singlePassRendering: true
2023/02/03 23:01:55.155 15938 15938 Warn UnityMain type=1400 audit(0.0:9171): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:55.155 15938 15938 Info chatty uid=10134(com.lil.augmented.associate) identical 2 lines
2023/02/03 23:01:55.155 15938 15938 Warn UnityMain type=1400 audit(0.0:9174): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:56.562 15938 15960 Info Unity FileContents: EMPTY
2023/02/03 23:01:56.562 15938 15960 Info Unity Localizer:Start()
2023/02/03 23:01:56.562 15938 15960 Info Unity
2023/02/03 23:01:56.637 15938 15960 Info Unity BadLine: 12294
2023/02/03 23:01:56.637 15938 15960 Info Unity TopStockManager:Start()
2023/02/03 23:01:56.637 15938 15960 Info Unity
2023/02/03 23:01:57.514 15938 15960 Info Unity Target status: Astronaut NO_POSE -- NOT_OBSERVED
2023/02/03 23:01:57.619 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9176): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:57.619 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9177): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:57.639 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9178): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:57.639 15938 15938 Info chatty uid=10134(com.lil.augmented.associate) identical 1 line
2023/02/03 23:01:57.639 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9180): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:01:58.969 15938 15989 Debug NetworkSecurityConfig No Network Security Config specified, using platform default
2023/02/03 23:02:03.007 15938 15938 Warn UnityGfxDeviceW type=1400 audit(0.0:9184): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
2023/02/03 23:02:07.886 15938 15960 Error Unity [XR] MLSnapshotGetTransformWithDerivatives(controllerState) failed with error MLSnapshotResult_DerivativesNotCalculated
2023/02/03 23:02:12.896 15938 15960 Error Unity [XR] MLSnapshotGetTransformWithDerivatives(controllerState) failed with error MLSnapshotResult_DerivativesNotCalculated
2023/02/03 23:02:17.905 15938 15960 Error Unity [XR] MLSnapshotGetTransformWithDerivatives(controllerState) failed with error MLResult_PoseNotFound
2023/02/03 23:02:25.615 15938 15938 Warn UnityMain type=1400 audit(0.0:9186): avc: denied { search } for name="traces" dev="nvme0n1p37" ino=4456451 scontext=u:r:untrusted_app:s0:c134,c256,c512,c768 tcontext=u:object_r:trace_data_file:s0 tclass=dir permissive=0
I'm not sure what other details to add. I'm simply adding Vuforia to the project according to the docs. The only difference I see at runtime is the missing green camera icon that's supposed to pop up and the request for camera recording does not pop-up either.
MLHubLogs-20230203-151220-win.zip (1.4 MB)
Above image is the permissions dialog that does not pop up and the GIF above is the green camera / dot icon that does not show up. These only occur on the empty project with Vuforia, and does not happen when I integrate Vuforia into our existing Unity app.
Hi @ryan.favale,
Just to confirm, you set the Android permissions for camera access in Project Settings > Magic Leap > Permissions?
Can you also please list the Magic Leap OS, Unity SDK and Unity editor versions you are using?
Hi @ryan.favale please note that the Vuforia Engine Magic Leap 2 integration instructions have changed, as the setup process in Unity is much easier now with their latest release. Please download the latest version of Engine (10.13) and take a look at the section in the guide regarding permissions. (Getting Started with Vuforia Engine and Magic Leap 2 | VuforiaLibrary).
In the Vuforia Engine release notes for 10.13 (Vuforia Engine Release Notes | VuforiaLibrary): "Unity applications using Vuforia will now automatically request all permissions required for Magic Leap 2". So please double check the permission settings in Project Settings -> Magic Leap -> Permissions.
Thanks,
-Evan
Vuforia Engine
I think you closed this ticket prematurely. I'm running through the same issue. The underlying problem is Vuforia isn't being initialized. The permissions, but also the camera not turning on -- those are symptoms of Vuforia not initializing.
It took a couple of days but here's a solution that works. I'm using Vuforia Engine 10.14.4 with Magic Leap SDK 1.4. Vuforia Engine wasn't starting in my scene. I knew this because the Magic Leap 2's green camera indicator wasn't turning on, and the "Vuforia Initialized" debug message never appeared in the debug log. The solution that worked for me was:
-
In Unity Window | Vuforia Configuration, I checked the "Delayed Initialization" checkbox. This allows me to start Vuforia manually.
-
I created a custom permission request script, which starts Vuforia only after camera, spatial mapping and anchors permissions are granted. Now my project works. I placed this on my camera object. Hopefully this helps others.
(Another tip: if you use the XR Rig prefab, you have to remove the ARSession and ARInput scripts from the XR Rig object when using Vuforia Engine 10.14.4 as well as previous versions.)
using UnityEngine;
using UnityEngine.XR.MagicLeap;
using Vuforia;
public class RequestVuforiaPermissions : MonoBehaviour
{
// Was Vuforia permission granted by user
private bool permissionCameraGranted = false;
private bool permissionSpatialMappingGranted = false;
private bool permissionSpatialAnchorsGranted = false;
private readonly MLPermissions.Callbacks permissionCallbacks = new MLPermissions.Callbacks();
private void Awake()
{
permissionCallbacks.OnPermissionGranted += OnPermissionGranted;
permissionCallbacks.OnPermissionDenied += OnPermissionDenied;
permissionCallbacks.OnPermissionDeniedAndDontAskAgain += OnPermissionDenied;
}
private void OnDestroy()
{
permissionCallbacks.OnPermissionGranted -= OnPermissionGranted;
permissionCallbacks.OnPermissionDenied -= OnPermissionDenied;
permissionCallbacks.OnPermissionDeniedAndDontAskAgain -= OnPermissionDenied;
}
void Start()
{
MLPermissions.RequestPermission(MLPermission.Camera, permissionCallbacks);
MLPermissions.RequestPermission(MLPermission.SpatialMapping, permissionCallbacks);
MLPermissions.RequestPermission(MLPermission.SpatialAnchors, permissionCallbacks);
}
private void OnPermissionDenied(string permission)
{
Debug.Log($"{permission} denied, example won't function.");
}
private void OnPermissionGranted(string permission)
{
switch (permission)
{
case MLPermission.Camera:
permissionCameraGranted = true;
break;
case MLPermission.SpatialMapping:
permissionSpatialMappingGranted = true;
break;
case MLPermission.SpatialAnchors: permissionSpatialAnchorsGranted = true;
break;
}
Debug.Log($"{permission} granted, example will function.");
if(permissionCameraGranted && permissionSpatialMappingGranted && permissionSpatialAnchorsGranted)
{
//vuforia can be started
VuforiaApplication.Instance.Initialize();
}
}
}
Thanks a bunch, man!
Been struggling to include Vuforia into the project that uses XR rig. Without it Vuforia works on ML2, but when I used the rig — it didn't.