Back to project page MySms.
The source code is released under:
Apache License
If you think the Android project MySms listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.henningta.mysms; //ww w.ja 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.widget.Toast; public class SmsDeliveredReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { WakeLocker.acquire(context); String source = intent.getStringExtra(Settings.KEY_SOURCE); String text = intent.getStringExtra(Settings.KEY_MESSAGE); long time = intent.getLongExtra(Settings.KEY_TIME, -1); if (source == null || text == null || time == -1) { // unexpected error, silently fail return; } DatabaseHandler dbHandler = new DatabaseHandler(context); Message message = dbHandler.getMessage(source, text, time); switch (getResultCode()) { case Activity.RESULT_OK: //Toast.makeText(context, "SMS delivered", Toast.LENGTH_SHORT).show(); message.setStatus(Message.STATUS_DELIVERED); break; case Activity.RESULT_CANCELED: Toast.makeText(context, "SMS not delivered", Toast.LENGTH_SHORT).show(); break; } // update message in database dbHandler.updateMessage(message); // refresh messages page Intent refreshIntent = new Intent(Settings.ACTION_MESSAGE); refreshIntent.putExtra(Settings.KEY_REFRESH, true); context.sendBroadcast(refreshIntent); WakeLocker.release(); } }