Mark
Mark

Reputation: 39881

Which class should we use for sending sms/text messages?

What class can we use to send a text message? I tried this on the emulator, 2.0:

import android.telephony.SmsManager;
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(...);

and that works ok. On my G1 running 1.5, I get a verify error, guessing because SmsManager is not available in 1.5. Maybe for 1.5 we need to use the deprecated class?:

android.telephony.gsm.SmsManager

is that correct, or is there some other class we're supposed to use for sending text messages?

Thanks

Upvotes: 0

Views: 881

Answers (1)

Yoni Samlan
Yoni Samlan

Reputation: 38075

Correct. android.telephony.SmsManager is only available for API level 4 and up (a.k.a Android 1.6). See the docs. You can use Android.os.Build.Version to figure out which to use on a given platform.

Upvotes: 2

Related Questions