Closed williamluke4 closed 2 years ago
Hi @williamluke4,
You can get the phone number from SmsMessage
instance as address
e.g.
final messages = await _query.querySms(
kinds: [SmsQueryKind.inbox, SmsQueryKind.sent],
// address: '+254712345789',
count: 10,
);
debugPrint('sms inbox messages: ${messages.length}');
for (var message in messages) {
debugPrint('phone number: ${message.address}');
}
Hey @jgithaiga,
I have finally had some time to have a look at this but it seems that the address returned here is the sender's address not the recipient's address.
As you can see below the following message was sent from Safaricom/MPESA to my number but the address shows MPESA, not my number.
Adding the subId then allowes you to look up the phone number from carrierInfo
Hey Julius, Thank you so much for creating this.
I'm currently using this here https://github.com/williamluke4/myPesa to extract transactions from M-PESA.
Was wondering how easy it would be to check what phone number or sim a message was sent to (i.e for multi-sim devices). I've had a brief dig around and it does not seem as trivial as I would have hoped.