Get Last Call Duration in android

后端 未结 9 1591
北荒
北荒 2020-12-03 15:20

I am looking for an easiest way to get call duration of last dialed number. So for e.g if I have made a call to my mom once I cut the call a notification with the duration s

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 15:50

    You need to use limit clause in your content query to get the last call details. So your content query will become

    Cursor cur = getContentResolver().query( CallLog.Calls.CONTENT_URI,
                 null, null, null, android.provider.CallLog.Calls.DATE + " DESC limit 1;");
    

提交回复
热议问题