title: java.lang.SecurityException:Unable to find app for caller android.app.ApplicationThreadProxy when registering receiver android.content.IIntentReceiver
body: <p>This error occurs when users have the first login after installing my app. But in the next launch (when the user already logged in) the app works fine.</p>
  
  <p>In my app I am using a <code>BroadcastReceiver</code> which is used for checking internet connectivity.</p>
  
  <p>So to be specific, the app is having above mentioned <code>Exception</code> while registering that <code>BroadcastReceiver</code>. Any help would be highly appereciated!</p>
  
  <p>My logcat is like below</p>
  
  <pre><code>java.lang.RuntimeException: Unable to resume activity {com.android.myproject/com.android.myproject.MapActivity}: java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43155660 (pid=24211) when registering receiver android.content.IIntentReceiver$Stub$Proxy@43151368
  1 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2762)
  2 at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2791)
  3 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1288)
  4 at android.os.Handler.dispatchMessage(Handler.java:99)
  5 at android.os.Looper.loop(Looper.java:137)
  6 at android.app.ActivityThread.main(ActivityThread.java:5095)
  7 at java.lang.reflect.Method.invokeNative(Native Method)
  8 at java.lang.reflect.Method.invoke(Method.java:511)
  9 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:845)
  10 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
  11 at dalvik.system.NativeStart.main(Native Method)
  12Caused by: java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43155660 (pid=24211) when registering receiver android.content.IIntentReceiver$Stub$Proxy@43151368
  13 at android.os.Parcel.readException(Parcel.java:1425)
  14 at android.os.Parcel.readException(Parcel.java:1379)
  15 at android.app.ActivityManagerProxy.registerReceiver(ActivityManagerNative.java:2228)
  16 at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1356)
  17 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1324)
  18 at android.app.ContextImpl.registerReceiver(ContextImpl.java:1318)
  19 at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:423)
  20 at com.android.myproject.MapActivity.onResumeOperations(MapActivity.java:584)
  21 at com.android.myproject.MapActivity.onResume(MapActivity.java:618)
  22 at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1185)
  23 at android.app.Activity.performResume(Activity.java:5203)
  24 at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2752)
  </code></pre>
  
  <p>In order to clarify my question, my <code>onResumeOperations()</code> look like </p>
  
  <pre><code> public void onResumeOperations(){
      if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER )&amp;&amp; !isFinishing()) {
          ShowGpsDialog();
      } else {
          removeGpsDialog();
      }
  
      registerReceiver(internetConnectionReciever, new IntentFilter(
              "android.net.conn.CONNECTIVITY_CHANGE"));
      registerReceiver(GpsChangeReceiver, new IntentFilter(
              LocationManager.PROVIDERS_CHANGED_ACTION));
      isRecieverRegistered = true;
  
      if (AndyUtils.isNetworkAvailable(this)
              &amp;&amp; manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
          if (!isDataRecieved) {
  
              checkStatus();
              startLocationUpdateService();
             // getPreReservations();
          }
      }
  
      registerIsApproved();
  
      startRepeatingChecker();
  }
  </code></pre>
  
  <p>this <code>onResumeOperations()</code> is called in <code>onResume()</code>. And as I previously mentioned, the problem occurs when registering <code>internetConnectionReceiver</code>.</p>