How do you create an Android SMS intent?

I think you are using the gsm version of SmsMessage. The gsm version is depreciated. SmsMessage works differently.

You should have these imports: import android.telephony. SmsManager and import android.telephony.SmsMessage. The following code will extract the message body and originating address.

The following code works in my broadcast receiver (note the individual pdu extraction) Bundle bundle = intent.getExtras(); if (bundle! = null) { Object pdus = (Object) bundle. Get("pdus"); for (int I = 0; I Show View->Other...->Emulator Control.

The view has Telephony and GPS entry capabilities. Stuff a bunch of Log. D into the code and watch logcat.

I think you are using the gsm version of SmsMessage. The gsm version is depreciated. SmsMessage works differently.

You should have these imports: import android.telephony. SmsManager and import android.telephony.SmsMessage. The following code will extract the message body and originating address.

The following code works in my broadcast receiver (note the individual pdu extraction). Bundle bundle = intent.getExtras(); if (bundle! = null) { Object pdus = (Object) bundle.

Get("pdus"); for (int I = 0; I Show View->Other...->Emulator Control. The view has Telephony and GPS entry capabilities. Stuff a bunch of Log.

D into the code and watch logcat...

Oooops. Make that Windows->Show View->Other...->Emulator Control. – Howard Hodson Jul 14 at 0:26 thanks for the reply, however as stated in the question, I want to know how to create an Intent in order to create a unit test for the onReceive method.

– Christian Jul 16 at 13:19 Can you run an app in one emulator that sends SMS messages to your test app in the other? Or could you test in the real world by logging to a file on the receiver's sdcard using apps on two phones? In the emulator, the send and receive intents don't do much.

– Howard Hodson Jul 16 at 15:58 I'm not interested in using the emulator or logging to test this. All I want is to create a unit test for the above mentioned method. And for this purpose I must create an SMS-Intent instance or mock an SMS-Intent instance (haven't yet explored the latter option).

I don't know how to accomplish the former. – Christian Jul 16 at 21:22 Ok. I think we are on different wave lengths on what a unit test is.TO me, there are framework driven unit tests.

Multiple devices/emulator simulated tests, and pure human procedural unit tests. Evidently you are referring to framework only testing. I don't think you're going to be able to get there from here... Good luck.

– Howard Hodson Jul 141 at 2:26.

I think you are using the gsm version of SmsMessage. The gsm version is depreciated. SmsMessage works differently.

You should have these imports: import android.telephony. SmsManager and import android.telephony.SmsMessage. The following code will extract the message body and originating address.

The following code works in my broadcast receiver (note the individual pdu extraction).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions