title: Monitoring MMS_RECEIVED like SMS_RECEIVED on android
body: <p>So I'm setting up a program that plays a sound that is set when you receive a message, mms or sms. I got it to work with SMS but MMS doesn't do anything. Here is the code for the class that runs the BroadcastReceiver:</p>
  
  <pre><code>/**
   * This class overrides the main BroadcastReceiver to play the tone
   * at the given textSoundPath.
   * @author Jesse Stewart
   *
   */
  public class TextMonitor extends BroadcastReceiver {
  
      public static String textSoundPath;     //this is the sound set to play when
                                              //sms or mms is received.
  
      @Override
      public void onReceive(Context arg0, Intent arg1) {
          MediaPlayer tonePlayer = new MediaPlayer();
  
          try {
              tonePlayer.setDataSource(textSoundPath);
          } catch (Exception e) {
              System.out.println("Couldn't set the media player sound!!!!!");
              e.printStackTrace();
          }
  
          try {
              tonePlayer.prepare();
          } catch (Exception e) {
              System.out.println("Couldn't prepare the tone player!!!!!");
              e.printStackTrace();
          }
  
          tonePlayer.start();
      }
  
  }
  </code></pre>
  
  <p>I set it up in the manifest like this:</p>
  
  <pre><code>&lt;receiver android:name=".TextMonitor"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
              &lt;action android:name="android.provider.Telephony.MMS_RECEIVED" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>and of course included:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_MMS" /&gt;
  </code></pre>
  
  <p>I also tried doing the receiver in the manifest like this:</p>
  
  <pre><code>&lt;receiver android:name=".TextMonitor"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  
  &lt;receiver android:name=".TextMonitor"&gt;
      &lt;intent-filter&gt;
              &lt;action android:name="android.provider.Telephony.MMS_RECEIVED" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>I also tried putting in the receiver:</p>
  
  <pre><code>&lt;action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED" /&gt;
  </code></pre>
  
  <p>But that just made nothing work.</p>
  
  <p>Any help would be appreciated. Thanks. On a side note too, why do you put a period before the class name sometimes in the manifest but not others? like android:name=".TextMonitor" and then sometimes android:name="TextMonitor".</p>