RMachnik
RMachnik

Reputation: 3684

How to get LastOutgoingCall from CallLog.Calls android?

I have problem, I don't know how to get LastOutgoingCall from android.provider.CallLog.Calls. There is a public method getLastOutgoingCall but I don't know how to accces it. I can create object CallLog.Calls but there is no such method like getLastOutgoingCall.

I know there is "Query the call log database for the last dialed number" but have no idea how to get and use it. For any tips and answers, thanks in advance.

Upvotes: 2

Views: 1052

Answers (2)

Kalaji
Kalaji

Reputation: 425

String lastDialed = CallLog.Calls.getLastOutgoingCall(getApplicationContext());

and of course add the permission to the manifest

<uses-permission android:name="android.permission.READ_CALL_LOG" />

Upvotes: 3

Krishnakant Dalal
Krishnakant Dalal

Reputation: 3578

Use content provider to get list of outgoing calls and arrange them in DESC order according to time and retrieve the first value of cursor.

Do some research to work on Content Provider.

Upvotes: 1

Related Questions