8

I want to create an Intent that opens the screen showing the call logs of the current device?

How would I specify such an Intent?

Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
Janusz
  • 187,060
  • 113
  • 301
  • 369

2 Answers2

27

Barmaley lead me to the correct path I did it with setting the type to Calls.ContentType.

Intent showCallLog = new Intent();
showCallLog.setAction(Intent.ACTION_VIEW);
showCallLog.setType(CallLog.Calls.CONTENT_TYPE);
context.startActivity(showCallLog);           

This intent should do the trick.

Janusz
  • 187,060
  • 113
  • 301
  • 369
  • 1
    @Janusz Is it possible to get the result back by selecting contact back from history ? As google is removing read call log permission, I am thinking for other alternative if any without this permission if I can access number from recent call log. – Smeet Nov 22 '18 at 06:44
  • 1
    @Smeet I have the same problem and had to remove the recent call log inside my app because of the restriction from google :-( Alternative I add the Intent to open the Call Log outside and the user have to tap on the 3 dots and select "share" to share the content with my app. So you get the contact back. Sadly this is again really bad user experience and I will again get A LOT of bad ratings :-( Really bad move from Google :-( – chrisonline Dec 02 '18 at 12:55
  • 2
    @Janusz Yes correct as there are lots of apps those are going to affect due to this move from Google. Until this permission is really required, we can not fill the form and request to allow this permission from Google. Developers are suffering a lot due to lots of changes from Google. Every day something new is happening. – Smeet Dec 02 '18 at 14:32
  • 1
    Is it possible to go to a call log history of a specific phone number ? – android developer Oct 07 '19 at 06:59
7
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("content://call_log/calls")); 
Barmaley
  • 16,638
  • 18
  • 73
  • 146