locked
Track Incoming and outgoing call in windows phone (Universal Windows) RRS feed

  • Question

  • How to handle incoming and outgoing calls in windows phone 10 (Universal Windows) App using Cordova Background Task

    Friday, March 3, 2017 7:30 AM

Answers

  • Hi Elvis ,

    Thanks for your reply.

    To track the incoming & out going call details like start time, end time & duration, i'm using the following code

    1. Create a background Task in appmanifest & select "Phone Call " property

    2. Give Entry Point . For Eg: sampleNamespace.sampleClass

    3.  public async void Run(IBackgroundTaskInstance taskInstance)
            {

              var operation = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite);           
                PhoneCallHistoryEntryReader reader = operation.GetEntryReader();
                var operation= await reader.ReadBatchAsync();

                var phoneCallHistoryEntry = operation[0];
                var startTime = phoneCallHistoryEntry.StartTime.ToString("dd-MM-yyyy HH:mm:ss");

    }

    • Marked as answer by Rini Mujeeb Friday, March 24, 2017 10:29 AM
    Friday, March 24, 2017 10:28 AM

All replies

  • Hi,

    What do you mean by "using Cordova Background Task"? Could you offer more details about that?

    Best Regards,

    Elvis Xia

    • Marked as answer by Rini Mujeeb Friday, March 24, 2017 10:19 AM
    • Unmarked as answer by Rini Mujeeb Friday, March 24, 2017 10:19 AM
    Monday, March 6, 2017 3:04 AM
  • Hi Elvis ,

    Thanks for your reply.

    To track the incoming & out going call details like start time, end time & duration, i'm using the following code

    1. Create a background Task in appmanifest & select "Phone Call " property

    2. Give Entry Point . For Eg: sampleNamespace.sampleClass

    3.  public async void Run(IBackgroundTaskInstance taskInstance)
            {

              var operation = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite);           
                PhoneCallHistoryEntryReader reader = operation.GetEntryReader();
                var operation= await reader.ReadBatchAsync();

                var phoneCallHistoryEntry = operation[0];
                var startTime = phoneCallHistoryEntry.StartTime.ToString("dd-MM-yyyy HH:mm:ss");

    }

    • Marked as answer by Rini Mujeeb Friday, March 24, 2017 10:29 AM
    Friday, March 24, 2017 10:28 AM