RECEIVE_SMS broadcast receiver not working?
<p>I have looked at all of the "common" mistakes, but I haven't made on (unfortuantely).</p>

<p>I cannot for the life of me figure out why (at the very least), I'm not getting a log message!</p>

<p>AndroidManifest.xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.liamwli.spyware.usertrack"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="10" /&gt;

    &lt;permission
        android:name="com.liamwli.spyware.usertrack.permission.PREFS"
        android:description="@string/permdisc"
        android:label="Prefs"
        android:logo="@drawable/ic_launcher"
        android:protectionLevel="signature" &gt;
    &lt;/permission&gt;

    &lt;uses-permission android:name="com.liamwli.spyware.usertrack.permission.PREFS" /&gt;

    &lt;permission
        android:name="com.liamwli.spyware.usertrack.permission.CONFIG"
        android:description="@string/permdiscconfig"
        android:label="Config"
        android:logo="@drawable/ic_launcher"
        android:protectionLevel="signature" &gt;
    &lt;/permission&gt;

    &lt;uses-permission android:name="com.liamwli.spyware.usertrack.permission.CONFIG" /&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
    &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
    &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;

    &lt;application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" &gt;
        &lt;activity
            android:name=".ProcessSMS"
            android:excludeFromRecents="true"
            android:label="@string/app_name" &gt;
        &lt;/activity&gt;
        &lt;activity android:name=".Launcher" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity
            android:name=".ActivityConfig"
            android:excludeFromRecents="true"
            android:exported="true"
            android:label="@string/app_name"
            android:permission="com.liamwli.spyware.usertrack.permission.CONFIG" &gt;
        &lt;/activity&gt;
        &lt;activity
            android:name=".Prefs"
            android:permission="com.liamwli.spyware.usertrack.permission.PREFS" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="com.liamwli.spyware.usertrack.PREFS" /&gt;

                &lt;category android:name="android.intent.cetagory.PREFERENCE" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

        &lt;receiver
            android:name=".CodeReceive"
            android:enabled="true"
            android:excludeFromRecents="true"
            android:exported="true" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.provider.Telephony.SECRET_CODE" /&gt;

                &lt;data android:scheme="android_secret_code" /&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
        &lt;receiver
            android:name=".ReceiveSMS"
            android:enabled="true"
            android:exported="true" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>ReceiveSMS.java:</p>

<pre><code>package com.liamwli.spyware.usertrack;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.telephony.SmsMessage;
import android.util.Log;

public class ReceiveSMS extends BroadcastReceiver {

    SharedPreferences prefs;
    SharedPreferences.Editor edit;

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub

        Log.d("User Track", "SMS Received!");

        prefs = PreferenceManager.getDefaultSharedPreferences(context);
        edit = prefs.edit();

        Bundle myBundle = intent.getExtras();
        SmsMessage[] messages = null;
        String strMessage = "";

        if (myBundle != null) {
            Object[] pdus = (Object[]) myBundle.get("pdus");
            messages = new SmsMessage[pdus.length];

            for (int i = 0; i &lt; messages.length; i++) {
                messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
                if (messages[i].getMessageBody().toString()
                        .equals(prefs.getString("cbp_pass", null))) {

                    Log.d("User Track", "Message Equals Password!");
                    Intent start = new Intent(context, ProcessSMS.class);
                    start.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    start.putExtra("Sender",
                            messages[i].getOriginatingAddress());
                    context.startActivity(start);

                }

            }

        }
    }
}
</code></pre>

<p>I don't even get an 'SMS Received!' log message, which tells me this isn't working at all.</p>

<p>A second question is, how can I make it that an SMS bypasses the SMS app and just goes to my app?</p>
