发送短信成功

来源:互联网 发布:流体热力学软件 编辑:程序博客网 时间:2024/04/30 12:35
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() {@Overridepublic 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));

0 0
原创粉丝点击