title: Android 5.0 (L) Service Intent must be explicit in Google analytics
body: <p>My code worked in &lt;5 but in Android 5.0 I'm running into an issue that I don't quite understand.</p>
  
  <pre><code>10-23 10:18:18.945: E/AndroidRuntime(8987): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }
  </code></pre>
  
  <p>My code works, even now, on 4.4.4 and below. So what do I need to do? I'll post relative code below. Also, during my googling I found this <a href="http://commonsware.com/blog/2014/06/29/dealing-deprecations-bindservice.html">post about java.lang.IllegalArgumentException: Service Intent must be explicit in regard to Android 5.0</a> but I don't understand what it means.</p>
  
  <h1>Manifest</h1>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="xxxxx.android.phone.xxxxx"
      android:versionCode="3"
      android:versionName="v1.2.4065" &gt;
  
      &lt;uses-sdk android:minSdkVersion="12"
          android:targetSdkVersion="21" /&gt;
  
      &lt;!-- Required for Google Analytics --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  
      &lt;!-- For push notifications (GCM) --&gt;
      &lt;permission android:name="xxxxx.android.phone.xxxxx.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt;
      &lt;uses-permission android:name="xxxxx.android.phone.xxxxx.permission.C2D_MESSAGE" /&gt;
      &lt;!-- App receives GCM messages. --&gt;
      &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
      &lt;!-- GCM connects to Google Services. --&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt; 
      &lt;!-- GCM requires a Google account. --&gt;
      &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
      &lt;!-- Keeps the processor from sleeping when a message is received. --&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
      &lt;!-- GCM - We handle notifications differently if the app is running --&gt;
      &lt;uses-permission android:name="android.permission.GET_TASKS" /&gt; 
  
      &lt;!-- Caching --&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;!-- The event subscribe button adds events to the calendar --&gt;
  &lt;!--    &lt;uses-permission android:name="android.permission.WRITE_CALENDAR" /&gt; --&gt;
  &lt;!--    &lt;uses-permission android:name="android.permission.READ_CALENDAR" /&gt;  --&gt;
  
      &lt;supports-screens
          android:resizeable="true"
          android:smallScreens="false"
          android:normalScreens="true"
          android:largeScreens="true"
          android:xlargeScreens="true"
          android:anyDensity="true" /&gt;
  
      &lt;application
          android:name="xxxxx.xxxxxApplication"
          android:icon="@drawable/app_icon"
          android:label="@string/app_name"
          android:allowBackup="true"
          android:largeHeap="true" &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;category android:name="xxxxx.android.phone.xxxxx" /&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.android.c2dm.intent.REGISTRATION" /&gt;
                  &lt;category android:name="xxxxx.android.phone.xxxxx" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;receiver 
              android:name="xxxxx.ConnectivityReceiver"
              android:enabled="false" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;activity 
              android:name=".SplashActivity"
              android:configChanges="locale|orientation" 
              android:theme="@style/Theme.Splash"
              android:screenOrientation="portrait"
              android:noHistory="true" &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:label="@string/app_name"
              android:theme="@style/Theme"
              android:windowSoftInputMode="adjustPan|stateVisible"
              android:name=".LoginActivity"
              android:configChanges="locale|orientation|screenSize" 
              android:screenOrientation="portrait" &gt;
          &lt;/activity&gt;
          &lt;activity 
              android:name=".MainActivity" 
              android:theme="@style/Theme"
              android:configChanges="locale|orientation|screenSize" 
              android:screenOrientation="portrait"
              android:windowSoftInputMode="adjustPan|stateVisible" /&gt;
  
          &lt;activity 
              android:name=".CountryPickerActivity" 
              android:theme="@style/Theme.Floating"
              android:configChanges="locale|orientation|screenSize" 
              android:screenOrientation="portrait"
              android:windowSoftInputMode="adjustPan|stateVisible" /&gt;
          &lt;activity 
              android:name=".EventPickerActivity" 
              android:theme="@style/Theme.Floating"
              android:configChanges="locale|orientation|screenSize" 
              android:screenOrientation="portrait"
              android:windowSoftInputMode="adjustPan|stateVisible" /&gt;
          &lt;activity 
              android:name=".TutorialActivity"
              android:theme="@style/Theme.Transparent"
              android:configChanges="locale|orientation|screenSize"
              android:screenOrientation="portrait" /&gt;
  
          &lt;activity 
              android:name=".VideoPlayerActivity" 
              android:theme="@style/Theme"
              android:configChanges="orientation|screenSize" /&gt;
  
          &lt;service android:name=".GCMIntentService" android:enabled="true" /&gt;
          &lt;meta-data android:name="com.crashlytics.ApiKey" android:value="xxxxxxxxxxxxxxxx"/&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <h1>GCMIntentService.java</h1>
  
  <pre><code>public class GCMIntentService extends GCMBaseIntentService {
  private static final int ATTEMPTS_MAX = 3;
  
  final static boolean USE_DEV = false;
  final static String XXXXX = "https://xxxxx/api.php";
  final static String XXXXX = "http://dev.xxxxx/api.php";
  final static String SUBSCRIPTION_KEY = "xxxxxxxxxxxxxxx"; // unique per app
  
      public GCMIntentService() {
          super(xxxxxx.SENDER_ID);
          if(GCMIntentService.USE_DEV) {
              host = XXXXX;
          } else {
              host = XXXXX;
          }
      }
  
      ...
  
  }
  </code></pre>
  
  <h1>** EDIT **</h1>
  
  <p>The more I look at this issue the more I think it's not in <code>GCMIntentService.java</code>. I should have posted my stack trace before which is:</p>
  
  <pre><code>10-23 13:17:08.095: E/AndroidRuntime(10560): FATAL EXCEPTION: GAThread
  10-23 13:17:08.095: E/AndroidRuntime(10560): Process: xxxxx.android.phone.xxxxx, PID: 10560
  10-23 13:17:08.095: E/AndroidRuntime(10560): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.gms.analytics.service.START (has extras) }
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at android.app.ContextImpl.bindService(ContextImpl.java:1751)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at com.google.analytics.tracking.android.AnalyticsGmsCoreClient.connect(AnalyticsGmsCoreClient.java:82)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at com.google.analytics.tracking.android.GAServiceProxy.connectToService(GAServiceProxy.java:279)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at com.google.analytics.tracking.android.GAServiceProxy.createService(GAServiceProxy.java:163)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at com.google.analytics.tracking.android.GAThread.init(GAThread.java:95)
  10-23 13:17:08.095: E/AndroidRuntime(10560):    at com.google.analytics.tracking.android.GAThread.run(GAThread.java:493)
  </code></pre>
  
  <p>So I'm going to try to run GA as explicit intent.</p>