title: Receiving SMS on Android App
body: <p>i followed a tutorial to receive SMS on my application and read it to pass the SMSbody to Toast.
  that is the Receiver class.</p>
  
  <pre><code>public class SmsReciever extends BroadcastReceiver {
          @Override
          public void onReceive(Context context, Intent intent){
          Bundle bundle= intent.getExtras();
          SmsMessage[] msgs= null;
          String str="";
          if(bundle != null ){
              Object [] pdus=(Object[]) bundle.get("pdus");
              msgs=new SmsMessage[pdus.length];
              for(int i=0; i&lt; msgs.length;i++){
                  msgs[i]= SmsMessage.createFromPdu((byte[])pdus[i]);
                  str+= msgs[i].getMessageBody();
  
              }
               Toast.makeText(context, str, Toast.LENGTH_LONG).show();
          }
          }
  
      }
  </code></pre>
  
  <p>the manifest file</p>
  
  <pre><code>    &lt;receiver android:name="com.msoft.masrooq.SmsReciever"&gt;
      &lt;intent-filter&gt;
      &lt;action android:name="android.provider.telephony.SMS_RECIEVED"&gt;&lt;/action&gt;
      &lt;/intent-filter&gt;
      &lt;/receiver&gt;
          &lt;uses-permission android:name="android.permission.RECEIVE_SMS"/&gt;
              &lt;uses-permission android:name="android.permission.READ_SMS" /&gt;
  </code></pre>
  
  <p>the app starts fine but it doesn't response to receiving sms
  it doesn't do anything.</p>