Android Open Source - ringydingydingy Sms Error Handler






From Project

Back to project page ringydingydingy.

License

The source code is released under:

GNU General Public License

If you think the Android project ringydingydingy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.dririan.RingyDingyDingy;
/*  w ww.j a v a  2  s . c o  m*/
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;
import android.util.Log;

public class SmsErrorHandler extends BroadcastReceiver {
    public static final String INTENT = "com.dririan.RingyDingyDingy.SMS_SENT";

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().compareTo(INTENT) == 0) {
            int resultCode = getResultCode();
            String tag = "RingyDingyDingy";
            String prefix = "Error sending SMS: ";

            switch(resultCode) {
            case Activity.RESULT_OK:
                // Since the SMS was sent, no need to log anything
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                String msg = "ERROR_GENERIC_FAILURE";

                if(intent.hasExtra("errorCode"))
                    msg += " (" + Integer.toString(intent.getIntExtra("errorCode", 0)) + ")";

                Log.e(tag, prefix + msg);
                break;
            case SmsManager.RESULT_ERROR_RADIO_OFF:
                Log.e(tag, prefix + "ERROR_RADIO_OFF");
                break;
            case SmsManager.RESULT_ERROR_NULL_PDU:
                Log.e(tag, prefix + "ERROR_NULL_PDU");
                break;
            case SmsManager.RESULT_ERROR_NO_SERVICE:
                Log.e(tag, prefix + "ERROR_NO_SERVICE");
                break;
            default:
                Log.e(tag, prefix + "Unknown result code: " + Integer.toString(resultCode));
                break;
            }
        }
    }
}




Java Source Code List

com.dririan.RingyDingyDingy.ApiHandler.java
com.dririan.RingyDingyDingy.ContactSupport.java
com.dririan.RingyDingyDingy.DeviceAdmin.java
com.dririan.RingyDingyDingy.DeviceDefaultDialogBuilder.java
com.dririan.RingyDingyDingy.GoogleVoiceReceiver.java
com.dririan.RingyDingyDingy.HoloDialogBuilder.java
com.dririan.RingyDingyDingy.LockingSupport.java
com.dririan.RingyDingyDingy.LogActivity.java
com.dririan.RingyDingyDingy.LogDatabase.java
com.dririan.RingyDingyDingy.LogEntry.java
com.dririan.RingyDingyDingy.LogHandler.java
com.dririan.RingyDingyDingy.LogOpenHelper.java
com.dririan.RingyDingyDingy.MainActivity.java
com.dririan.RingyDingyDingy.MessageHandler.java
com.dririan.RingyDingyDingy.NotificationHandler.java
com.dririan.RingyDingyDingy.PreferencesActivity.java
com.dririan.RingyDingyDingy.PreferencesManager.java
com.dririan.RingyDingyDingy.RemoteRingActivity.java
com.dririan.RingyDingyDingy.SmsErrorHandler.java
com.dririan.RingyDingyDingy.SmsReceiver.java
com.dririan.RingyDingyDingy.ThemedDialogBuilder.java
com.dririan.RingyDingyDingy.ToggleHandler.java