SMS が正常に送信されたかどうかを確認するにはどうすればよいですか?
ドキュメントを確認しましたが、問題を解決する方法が見つかりませんでした...どうすればそれを知ることができますか?
//---when the SMS has been sent---
registerReceiver(new BroadcastReceiver(){
@Override
public void onReceive(Context arg0, Intent arg1) {
switch (getResultCode())
{
case Activity.RESULT_OK:
Toast.makeText(getBaseContext(), "SMS sent",Toast.LENGTH_SHORT).show();
getServerData("http://site.com","id",Id);
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
System.exit(0);
Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
System.exit(0);
Toast.makeText(getBaseContext(), "No service", Toast.LENGTH_SHORT).show();
break;
case SmsManager.STATUS_ON_SIM_UNSENT:
System.exit(0);
Toast.makeText(getBaseContext(), "Message unsent", Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
System.exit(0);
Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show();
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
System.exit(0);
Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show();
break;
case SmsManager.STATUS_ON_SIM_SENT :
System.exit(0);
Toast.makeText(getBaseContext(), "Message sent", Toast.LENGTH_SHORT).show();
break;
}
}
}, new IntentFilter(SENT));
//---when the SMS has been delivered---
registerReceiver(new BroadcastReceiver(){
@Override
public void onReceive(Context arg0, Intent arg1) {
switch (getResultCode())
{
case Activity.RESULT_OK:
//Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show();
break;
case Activity.RESULT_CANCELED:
// Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show();
break;
}
}
}, new IntentFilter(DELIVERED));
if(isMobileAvailable(getApplicationContext()) == true){
Toast.makeText(getApplicationContext(), "Reseau mobile: OK !", Toast.LENGTH_LONG).show();
ArrayList<String> parts = (ArrayList<String>) splitInChunks(message, 120);
for (String str : parts) {
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, str, null, null);
}
getServerData("http://site.com","id",Id);
}else
Toast.makeText(getApplicationContext(), "Reseau mobile: NOK !", Toast.LENGTH_LONG).show();
}
SMS が正常に送信されたかどうかを知りたいだけです... トランクス !