PendingIntent sentIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(SENT_SMS_ACTION), 0); manager.sendTextMessage(num, null, content, sentIntent, null);//判断是否发送成功
<receiver android:name=".AutoSendMessageBroadcastReceiver"> <intent-filter android:priority="1000"> <action android:name="android.intent.action.SENT_SMS_ACTION"/> </intent-filter> </receiver>
public class AutoSendMessageBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub switch (getResultCode()) { case -1: Toast.makeText(context, "短信发送成功", Toast.LENGTH_SHORT).show(); break; case 0: Toast.makeText(context, "发送失败", Toast.LENGTH_LONG).show(); break; default: break; } } }