Example #1
0
            public async void Run(IBackgroundTaskInstance taskInstance)
            {
                PhoneCallOriginDataRequestTriggerDetails callDetails =
                    (PhoneCallOriginDataRequestTriggerDetails)taskInstance.TriggerDetails;

                var deferral = taskInstance.GetDeferral();
                //look up local data source for call's location and category
                PhoneCallOrigin data = LocalLookupForCallerData(callDetails.PhoneNumber);

                //set phone call origin
                PhoneCallOriginManager.SetCallOrigin(callDetails.targetId, data);

                deferral.Complete();
            }
Example #2
0
        //
        // The Run method is the entry point of a background task.
        //
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            // Associate a cancellation handler with the background task.
            // Even though this task isn't performing much work, it can still be cancelled.
            taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled);

            // Do the background task activity.
            BackgroundTaskDeferral _deferral = taskInstance.GetDeferral();

            PhoneCallOriginDataRequestTriggerDetails callDetails = (PhoneCallOriginDataRequestTriggerDetails)taskInstance.TriggerDetails;
            PhoneCallOrigin phoneCallOrigin = LocalLookupForCallerData(callDetails.PhoneNumber);

            PhoneCallOriginManager.SetCallOrigin(callDetails.RequestId, phoneCallOrigin);

            _deferral.Complete();
        }