ContentObserver in Android
<p>I have successfully monitor incoming SMS and sent it to database for viewing later. I have read about monitor outgoing sms and I don't really understand how it works. Can someone guide me how to code to monitor outgoing sms by using ContentObserver? I will post all my current codes for incoming sms.need guide from where I should start.</p>

<p>smsReceiver.java</p>

<pre><code>package terima.sms.inbox;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.gsm.SmsMessage;
import java.net.*;
import java.io.*;

@SuppressWarnings("deprecation")
public class SmsReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Bundle bundle = intent.getExtras();

        Object messages[] = (Object[]) bundle.get("pdus");
        SmsMessage SMS[] = new SmsMessage[messages.length];
        for (int n = 0; n &lt; messages.length; n++) {
            SMS[n] = SmsMessage.createFromPdu((byte[]) messages[n]);
        }

        String member_id = "1";

        inbox(SMS[0].getOriginatingAddress(), SMS[0].getMessageBody(), member_id);
    }

    public static Boolean inbox(String telefon, String message, String member_id){

        String mesej = "";
        for(int i = 0; i &lt; message.length(); i++)
        {
            if(message.charAt(i) == ' ' || message.charAt(i) == '+')
            {
                if(message.charAt(i) == ' ')
                    mesej += "%20";
                else
                    mesej += "%2B";
            }
            else
            {
                mesej += message.charAt(i);
            }
        }

        try
        {
            URL oracle = new URL("http://192.168.1.111/inbox.php?message=" + mesej + "&amp;telefon=" + telefon + "&amp;member=" + member_id);
            BufferedReader in = new BufferedReader(new InputStreamReader(oracle.openStream()));

            String fetch, total = "";
            while ((fetch = in.readLine()) != null)
                total += fetch;
            in.close();

            if(total.equals("1"))
                return true;

            return false;
        }
        catch(Exception e)
        {
            return false;
        }
    }
}
</code></pre>

<p>thanks in advance.</p>
