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 co开发者_开发问答rrect, or is there some other class we're supposed to use for sending text messages?
Thanks
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.
精彩评论