Unfortunately, there is no direct way. Why?
Because Android only writes to the call log after the call is finished, and there is no system broadcast saying "a new entry was added to the call log."
But you can Workaround in this way:
You can listen to the call state using a plugin like phone_state
, and then trigger an update after the call has ended.
Simple steps:
Listen for changes in phone status (ringing, connected, ended).
Wait 1-2 seconds on disconnected
or ended
(to give the system time to write to the call log).
Then fetch call log again.
Enjoy!