I'm using this code and it retrieve incoming message successfully:
Bundle bundle = intent.getExtras();
Object[] object = (Object[]) bundle.get("pdus");
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) object[0]);
String message = smsMessage.getMessageBody().trim();
The message is exactly equal to "test" and message.length()
is equal to 4 (no hidden chars) but the bellow command returns false!
if (message == "test") ...
How to use == instead equals()?
Thanks...
You should use below:-
message.equals("test")
for more info read below question:-