/// <summary>
        /// Starts up MLFoundObjects.
        /// </summary>
        public static MLResult Start()
        {
            #if PLATFORM_LUMIN
            result = MLPrivilegesStarterKit.Start();
            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLFoundObjectsStarterKit failed when calling MLPrivilegesStarterKit.Start. Reason: {0}", result);
                return(result);
            }

            result = MLPrivilegesStarterKit.RequestPrivileges(MLPrivileges.Id.ObjectData);
            if (result.Result != MLResult.Code.PrivilegeGranted)
            {
                Debug.LogErrorFormat("Error: MLFoundObjectsStarterKit failed requesting privileges. Reason: {0}", result);
                return(result);
            }
            MLPrivilegesStarterKit.Stop();

            result = MLFoundObjects.Start();
            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLFoundObjectsStarterKit failed starting MLFoundObjects. Reason: {0}", result);
            }
            return(result);
            #endif
        }
Exemple #2
0
        #pragma warning restore 649

        /// <summary>
        /// Starts up MLImageTracker.
        /// Invokes the callback after privleges have been succesfully requested and MLImageTracker is started.
        /// </summary>
        public static MLResult Start()
        {
            #if PLATFORM_LUMIN
            _result = MLPrivilegesStarterKit.Start();
            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed when calling MLPrivilegesStarterKit.Start. Reason: {0}", _result);
                return(_result);
            }

            _result = MLPrivilegesStarterKit.RequestPrivileges(MLPrivileges.Id.CameraCapture);
            if (_result.Result != MLResult.Code.PrivilegeGranted)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed requesting privileges. Reason: {0}", _result);
                return(_result);
            }
            MLPrivilegesStarterKit.Stop();

            _result = MLImageTracker.Start();
            if (!_result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLImageTrackerStarterKit failed starting MLImageTracker. Reason: {0}", _result);
            }
            #endif

            return(_result);
        }
        /// <summary>
        /// Start the MLLocation API.
        /// </summary>
        public static MLResult Start()
        {
            MLResult result = MLPrivilegesStarterKit.Start();

            #if PLATFORM_LUMIN
            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLLocationStarterKit failed starting MLPrivilegesStarterKit, Reason {0} ", result);
                return(result);
            }
            result = MLPrivilegesStarterKit.RequestPrivileges(MLPrivileges.Id.FineLocation, MLPrivileges.Id.CoarseLocation);

            if (result.Result != MLResult.Code.PrivilegeGranted)
            {
                Debug.LogErrorFormat("Error: MLLocationStarterKit failed requesting privileges, reason {0} ", result);
                return(result);
            }

            MLPrivilegesStarterKit.Stop();

            result = MLLocation.Start();

            if (!result.IsOk)
            {
                Debug.LogErrorFormat("Error: MLLocationStarterKit failed to start, Reason: {0}", result);
            }
            #endif

            return(result);
        }