Re: [android-developers] Re: more SMS questions
Hello,
I have tried using Base64.encode() with the sendDataMessage as follows:
smsManager.sendDataMessage("5558", null, (short) 1500,
Base64.encode("hello SMS".getBytes(), Base64.DEFAULT), null, null);
I have also tried putting the following in my AndroidManifest.xml but
no luck on the emulator.
<receiver android:name=".SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED"></action>
<action android:name="android.intent.action.DATA_SMS_RECEIVED" />
<data android:scheme="sms" />
<data android:host="localhost" />
<data android:port="1500" />
</intent-filter>
</receiver>
The result is the following output in adb logcat when the message is
received (some garbage is shown
as a notification as the text message arrives):
V/Telephony( 295): getOrCreateThreadId cursor cnt: 1
However I don't see the calls from my boardcast receiver being called.
I don't understand why it's not being called.
Any ideas?
public class SMSReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "hello received");
Object[] pduArray = (Object[]) intent.getExtras().get("pdus");
SmsMessage[] messages = new SmsMessage[pduArray.length];
for (int i = 0; i < pduArray.length; i++) {
Log.d(TAG, "received");
messages[i] = SmsMessage.createFromPdu((byte[]) pduArray[i]);
Log.d(TAG, messages[i].getDisplayOriginatingAddress());
Log.d(TAG, messages[i].getMessageBody());
}
}
private static final String TAG = "SMSReceiver";
}
Many thanks,
Regards,
John Goche
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home