title: Leaked IntentReceiver error when calling GCMRegistrar.register()
body: <p>I'm trying to finish the getting started steps on <a href="http://developer.android.com/guide/google/gcm/gs.html" rel="nofollow">Google's GCM</a> from Google's Android Developer site.</p>
  
  <p>When my device tries to register, it fails with the following reason:</p>
  
  <blockquote>
    <p>Activity has leaked IntentReceiver from com.google.android.gcm.GCMBroadcastReceiver that was originally registered here. Are you missing a call to unregisterReceiver?</p>
  </blockquote>
  
  <p>This is the code:</p>
  
  <pre><code>GCMRegistrar.checkDevice(this);
  GCMRegistrar.checkManifest(this);
  final String regId = GCMRegistrar.getRegistrationId(this);
  if (regId.equals("")) {
      GCMRegistrar.register(this, senderId); // &lt;-- It fails here
  } else {
      Log.v("GCM", "Already registered");
  }
  </code></pre>
  
  <p>Any idea? </p>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>Update</strong></p>
  
  <p>This is my manifest:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.sample"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk android:minSdkVersion="8" /&gt;
  
      &lt;permission android:name="com.sample.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt;
  
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
      &lt;uses-permission android:name="com.sample.permission.C2D_MESSAGE" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name" &gt;
  
          &lt;activity
              android:name=".sample"
              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;/activity&gt;
          &lt;activity android:theme="@android:style/Theme.NoTitleBar" android:name=".Main" android:screenOrientation="portrait" /&gt;
          &lt;receiver android:name="com.google.android.gcm.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" &gt;
            &lt;intent-filter&gt;
              &lt;action android:name="com.google.android.c2dm.intent.RECEIVE" /&gt;
              &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
              &lt;category android:name="com.sample" /&gt;
            &lt;/intent-filter&gt;
          &lt;/receiver&gt;               
          &lt;service android:name="com.sample.GCMIntentService" /&gt;
          &lt;uses-library android:name="com.google.android.maps" /&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>