title: SecurityException: Parcel.readException coming from google analytics code
body: <p>Our app is getting quite a few different <code>SecurityException</code> reports from our crash report software. Here is a stacktrace of the crash:</p>
  
  <pre><code>java.lang.SecurityException: Unable to find app for caller android.app.ApplicationThreadProxy@43fda840 (pid=17925) when registering receiver android.content.IIntentReceiver$Stub$Proxy@43fd9458
       at android.os.Parcel.readException(Parcel.java:1431)
       at android.os.Parcel.readException(Parcel.java:1385)
       at android.app.ActivityManagerProxy.registerReceiver(ActivityManagerNative.java:2466)
       at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1717)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1685)
       at android.app.ContextImpl.registerReceiver(ContextImpl.java:1679)
       at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:453)
       at com.google.android.gms.analytics.q.v(Unknown Source)
       at com.google.android.gms.analytics.r.cF(Unknown Source)
       at com.google.android.gms.analytics.r.cH(Unknown Source)
       at com.google.android.gms.analytics.s.cO(Unknown Source)
       at com.google.android.gms.analytics.s.cP(Unknown Source)
       at com.google.android.gms.analytics.s.d(Unknown Source)
       at com.google.android.gms.analytics.s$e.run(Unknown Source)
       at java.util.Timer$TimerImpl.run(Timer.java:284)
  </code></pre>
  
  <p>The stack trace is always the same, except the only thing that seems to change is <code>android.app.ApplicationThreadProxy@41da9030 (pid=9103)</code> and <code>android.content.IIntentReceiver$Stub$Proxy@41ee0688</code> have different numbers on them (is this thread id's or something?)</p>
  
  <p>Now this exception seems to be linked to intent size (see the following links)</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/18096607/using-crop-intent-getting-java-lang-securityexception-unable-to-find-app-for-ca">stackoverflow post</a></li>
  <li><a href="https://stackoverflow.com/questions/12691149/when-i-send-hashmap-with-size-more-than-20-in-android-4-1-i-get-crash">another stackoverflow post</a></li>
  <li><a href="https://stackoverflow.com/questions/13458544/android-service-onbind-securityexception">see the comment on this question</a></li>
  <li><a href="https://groups.google.com/forum/#!topic/android-developers/YqKnSCNTZYU" rel="noreferrer">see b0bs reply here</a></li>
  </ul>
  
  <p>Is this the only cause? If so how is my code causing this when it seems to only come from <code>google analytics</code> code? Am I using GA wrong? I  don't seem to be doing much besides making a tracker.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This is how I am creating my tracker. I have a <code>singleton</code> tracker in my application object</p>
  
  <pre><code>Tracker appTracker;
  synchronized Tracker getTracker()
  {
      GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
      if (appTracker == null)
      {
          appTracker = analytics.newTracker([some key]);
          appTracker.enableAdvertisingIdCollection(true);
          analytics.getLogger().setLogLevel(Logger.LogLevel.VERBOSE);
      }
  
  
      return appTracker;
  }
  </code></pre>
  
  <p>Then in my BaseActivity I have the following code:</p>
  
  <pre><code>public void initAnalytics() {
  
      if (Global.TRACKING_ENABLED) {
          mTracker = app.getTracker();
      }
  }
  
  public void sendCommerceData(Map&lt;String, String&gt; params)
  {
      mTracker.send(params);
  }
  
  public void sendTrackViewData(String _path)
  {
      mTracker.setScreenName(_path);
      mTracker.send(new HitBuilders.AppViewBuilder().build());
  }
  
  public void sendEventData(String category, String action, String label, long value)
  {
      mTracker.send(new HitBuilders.EventBuilder()
              .setCategory(category)
              .setAction(action)
              .setLabel(label)
              .setValue(value).build());
  }
  </code></pre>
  
  <p><strong><em>EDIT 2</em></strong></p>
  
  <p>ok here is the use of sendCommerceData:</p>
  
  <pre><code> sendCommerceData(new HitBuilders.ItemBuilder()
                                          .setTransactionId(Integer.toString(order.orderId))
                                          .setName(orderItem.tradeTitle)
                                          .setSku(orderItem.tradeId)
                                          .setCategory(orderItem.categoryFullname)
                                          .setPrice(price)
                                          .setQuantity(orderItem.quantity)
                                          .build());
  </code></pre>
  
  <p>u_u</p>