smsSender is not pulled from SMS-message
OleTheill opened this issue · comments
In the SmsBroadcastReceiver the String smsSender is declared as empty ("").
But the sender is filled with information.
link to source: https://github.com/JoaquimLey/sms-parsing/blob/master/app/src/main/java/com/joaquimley/smsparsing/SmsBroadcastReceiver.java
The result is that the line
Log.d(TAG, "SMS detected: From " + smsSender + " With text " + smsBody);
doesn't show the smsSender.
Forgive me if my issue is formatted or explained badly - this is the first time I interact on GitHub :) - thanks for a great code it helped me a great deal!
The solution seems to be to change
for (SmsMessage smsMessage : Telephony.Sms.Intents.getMessagesFromIntent(intent)) {
smsBody += smsMessage.getMessageBody();
}
to
for (SmsMessage smsMessage : Telephony.Sms.Intents.getMessagesFromIntent(intent)) {
smsBody += smsMessage.getMessageBody();
smsSender += smsMessage.getOriginatingAddress();
}
Hey there @OleTheill I've updated the receiver with the code from the article:
Let me know if this helps you out ;)
Closing due to inactivity.