I use this library to get call log in flutter
call_log: ^3.2.1
for (CallLogEntry entry in _callLogEntries) {
children.add(
Column(
children: <Widget>[
const Divider(),
Text('F. NUMBER : ${entry.formattedNumber}', style: mono),
Text('C.M. NUMBER: ${entry.cachedMatchedNumber}', style: mono),
Text('NUMBER : ${entry.number}', style: mono),
Text('NAME : ${entry.name}', style: mono),
Text('TYPE : ${entry.callType}', style: mono),
Text('DATE : ${DateTime.fromMillisecondsSinceEpoch(entry.timestamp)}',
style: mono),
Text('DURATION : ${entry.duration}', style: mono),
Text('ACCOUNT ID : ${entry.phoneAccountId}', style: mono),
Text('SIM NAME : ${entry.simDisplayName}', style: mono),
],
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
),
);
}
How to find a call log is comming from sim 1or sim2
You can identify the SIM slot using the phoneAccountId property.
Here, In the above code, If the phoneAccountId contains the number "0", it is assumed that SIM 1 was used. If it contains the number "1", it is assumed that SIM 2 was used.