String SENT_SMS_ACTION = "SENT_SMS_ACTION";
Intent sentIntent = new Intent(SENT_SMS_ACTION);
sentIntent.putExtra("idSms", id);
PendingIntent sentPI = PendingIntent.getBroadcast(this,
Integer.parseInt(id), sentIntent,
Integer.parseInt(id));
this.registerReceiver(new BroadcastReceiver() {
@Override
public synchronized void onReceive(Context _context,
Intent _intent) {
int indexx = -1;
switch (getResultCode()) {
case Activity.RESULT_OK:
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
System.out
.println("--RESULT_ERROR_GENERIC_FAILURE--");
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
System.out
.println("--RESULT_ERROR_RADIO_OFF--");
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
System.out.println("--RESULT_ERROR_NULL_PDU--");
break;
}
}
}, new IntentFilter(SENT_SMS_ACTION));
发送短信成功
最新推荐文章于 2021-05-25 22:25:03 发布