2016-03-19 9 views
2

ここでは通話履歴返しますのみ、最後の20のログ

PhoneCallHistoryStore store = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite); 
PhoneCallHistoryEntryQueryOptions options = new PhoneCallHistoryEntryQueryOptions() { DesiredMedia = PhoneCallHistoryEntryQueryDesiredMedia.All }; 
PhoneCallHistoryEntryReader reader = store.GetEntryReader(options); 
var logs = await reader.ReadBatchAsync(); 

を取得logs.Countどのように私はすべてのログを取得することができ、常に20

のですか?

答えて

2

はい、正しい動作です。メソッドの名前にはBatchがあります。それはあなたがコール(20項目)の一部を取ることを意味します。すべての電話を受けるには、次のコードを使用してください:

PhoneCallHistoryStore store = await PhoneCallHistoryManager.RequestStoreAsync(PhoneCallHistoryStoreAccessType.AllEntriesLimitedReadWrite); 
    PhoneCallHistoryEntryQueryOptions options = new PhoneCallHistoryEntryQueryOptions() { DesiredMedia = PhoneCallHistoryEntryQueryDesiredMedia.All }; 
    PhoneCallHistoryEntryReader reader = store.GetEntryReader(options); 
    var phoneCallHistoryEntries = new List<PhoneCallHistoryEntry>(); 

    var hasItems = true; 
    do 
    { 
     var logs = await reader.ReadBatchAsync(); 
     phoneCallHistoryEntries.AddRange(logs); 
     hasItems = logs.Count > 0; 
    } 
    while (hasItems); 
+0

ありがとうございます。私は実際にそれをもう一度呼び出すことを試みましたが、私は同じ結果をもう一度得ました。あなたの答えを読んだ後、私はもう一度試してみました。 – Deepak

関連する問題