1 回答

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超8個(gè)贊
private boolean isChecked = true;
final BroadcastReceiver sendSMS = new BroadcastReceiver() {
@Override
public void onReceive(Context arg0, Intent arg1) {
while(isChecked == true){
switch (getResultCode()) {
case Activity.RESULT_OK:
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
Toast.makeText(getContext(), "Generic failure",
Toast.LENGTH_SHORT).show();
isChecked = false;
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
Toast.makeText(getContext(), "No service",
Toast.LENGTH_SHORT).show();
isChecked = false;
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
Toast.makeText(getContext(), "Null PDU",
Toast.LENGTH_SHORT).show();
isChecked = false;
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
Toast.makeText(getContext(), "Radio off",
Toast.LENGTH_SHORT).show();
isChecked = false;
break;
}
}
}
};
如果消息正確且您想要繼續(xù),或者如果消息是假的,請(qǐng)創(chuàng)建一段時(shí)間以進(jìn)行欺騙。
添加回答
舉報(bào)