title: SecurityException: Not allowed to start service Intent act=com.google.android.c2dm.intent.REGISTER
body: <p>I get the error <code>SecurityException: Not allowed to start service Intent</code> but looks like it do not have good solution after searching many topics.</p>
  
  <p>Please help me,</p>
  
  <p>Thanks,</p>
  
  <p>p/s :</p>
  
  <p>I'm make sure I used correct <code>SENDER_ID</code> as project number was defined at <code>Google API Console</code> and correct <code>package name</code>.</p>
  
  <p><strong>Error :</strong></p>
  
  <pre><code>Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE
              at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1785)
              at android.app.ContextImpl.startService(ContextImpl.java:1757)
              at android.content.ContextWrapper.startService(ContextWrapper.java:480)
              at com.google.android.gms.gcm.GoogleCloudMessaging.e(Unknown Source)
              at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
              at controller.RegisterGCMClientAsync.doInBackground(RegisterGCMClientAsync.java:62)
              at controller.RegisterGCMClientAsync.doInBackground(RegisterGCMClientAsync.java:18)
              at android.os.AsyncTask$2.call(AsyncTask.java:287)
              at java.util.concurrent.FutureTask.run(FutureTask.java:234)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
              at java.lang.Thread.run(Thread.java:841)
  </code></pre>
  
  <p><strong>Manifest.xml file:</strong></p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="app.cloudstringers" &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="app.cloudstringers.Cloudstringers"
          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:name="ui.fragment.RegisterWithAccountsFragment" /&gt;
  
      &lt;meta-data android:name="com.google.android.gms.version"
                 android:value="@integer/google_play_services_version" /&gt;
  
      &lt;permission
          android:name="app.cloudstringers.permission.C2D_MESSAGE"
          android:protectionLevel="signature" /&gt;
  
      &lt;!-- Receiver GCM --&gt;
      &lt;receiver
          android:name="app.cloudstringers.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;category android:name="app.cloudstringers" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;!-- Service GCM --&gt;
      &lt;service
          android:exported="true"
          android:name="app.cloudstringers.GcmIntentService" /&gt;
  
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
      &lt;uses-permission android:name="app.cloudstringers.permission.C2D_MESSAGE" /&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>SOLUTION</strong>
  I put wrong lines. Should put <code>&lt;use-permission&gt;</code> tag outside of <code>&lt;application&gt;</code> tag.</p>