sms receiver from broadcast receiver
<p>I am building a simple app to receive <code>SMS</code> using <code>broadcast receiver</code> on <code>ICS</code> platform , but it is  <b> not receiving SMS</b> at all ... it do not show a <code>Toast</code> ?</p>

<p>I have 3 class:</p>

<ol>
<li>MessageActivity: which is main class </li>
<li>SimpleSmsRecever: to receive <code>sms</code></li>
<li>Reply: to reply</li>
</ol>

<p>my mainfest file is :</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.example.message"
android:versionCode="1"
android:versionName="1.0" &gt;

&lt;uses-sdk android:minSdkVersion="15" /&gt;

&lt;application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" &gt;
    &lt;activity
        android:name=".MessageActivity"
        android:label="@string/app_name" &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;receiver android:name=".SmsReceiver" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    &lt;/activity&gt;
    &lt;activity android:name=".Reply" &gt;
    &lt;/activity&gt;
&lt;/application&gt;
&lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
&lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
&lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
</code></pre>

<p></p>

<p>My code for Receive Sms is:</p>

<pre><code>public class SmsReceiver extends BroadcastReceiver {

private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
private static final String TAG = "SMSBroadcastReceiver";
private static String sender, body;
private static int flag = 0;

@Override
public void onReceive(Context context, Intent intent) {

    MessageActivity mvt = null;

    Log.i(TAG, "Intent recieved: " + intent.getAction());

    if (intent.getAction() == SMS_RECEIVED) {
        Bundle bundle = intent.getExtras();
        if (bundle != null) {
            Object[] pdus = (Object[]) bundle.get("pdus");
            final SmsMessage[] messages = new SmsMessage[pdus.length];
            for (int i = 0; i &lt; pdus.length; i++) {
                messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]);
            }

            if (messages.length &gt; -1) {
                flag = 1;
                sender = messages[0].getOriginatingAddress();
                body = messages[0].getMessageBody();
                Log.i(TAG,
                        "Message recieved: " +   messages[0].getMessageBody());
                Toast.makeText(context, messages[0].getMessageBody(),
                        Toast.LENGTH_SHORT).show();

            }
        }
    }
}
}
</code></pre>

<p>Please help, I kind of have the feeling that it has something to do with <code>ICS</code>. I read it somewhere while googling... Thanks.</p>
