title: AppInvites "Install" link doesn't open the app
body: <p>It happens from time to time, also with Google's sample app (<a href="https://github.com/googlesamples/google-services/tree/master/android/appinvites">https://github.com/googlesamples/google-services/tree/master/android/appinvites</a>). App is installed on device but instead of opening the app, "Install" link:</p>
  
  <ul>
  <li>Opens web browser on Lollipop and earlier, than it suggests to "Open with play store" </li>
  <li>Stucks on email client (Gmail) on Marshmallow. It seems that something is happening (status bar is blinking) but no app is opened.</li>
  </ul>
  
  <p>Those are logs from Marshamallow (seems that Google apis returns some 401's):</p>
  
  <pre><code>09-10 08:14:12.692      795-813/? I/ActivityManager﹕ Displayed 
  
  com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity: +92ms
  09-10 08:14:12.714  23045-23082/? E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xa96e4530
  09-10 08:14:12.752      795-804/? I/art﹕ Background partial concurrent mark sweep GC freed 599(43KB) AllocSpace objects, 0(0B) LOS objects, 30% free, 35MB/51MB, paused 2.199ms total 171.864ms
  09-10 08:14:12.875  23045-23093/? E/Volley﹕ [20360] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/plusdatamixer/v1/mutateonekey?alt=proto&amp;key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk
  09-10 08:14:12.876  23045-23110/? E/AppInviteAgent﹕ Error communicating with server com.android.volley.AuthFailureError
  09-10 08:14:12.896     795-1943/? I/ActivityManager﹕ START u0 {act=android.intent.action.VIEW dat=https://plus.google.com/... flg=0x14000000 cmp=com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity} from uid 10011 on display 0
  09-10 08:14:12.978  23045-23112/? W/BaseAppContext﹕ Using Auth Proxy for data requests.
  09-10 08:14:13.024    1731-1731/? I/Keyboard.Facilitator﹕ onFinishInput()
  09-10 08:14:13.047      795-813/? I/ActivityManager﹕ Displayed com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity: +88ms
  09-10 08:14:13.070  23045-23082/? E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xa96e4580
  09-10 08:14:13.108      795-804/? I/art﹕ Background partial concurrent mark sweep GC freed 676(64KB) AllocSpace objects, 1(20KB) LOS objects, 30% free, 35MB/51MB, paused 2.421ms total 188.050ms
  09-10 08:14:13.174  23045-23091/? E/Volley﹕ [20358] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/plusdatamixer/v1/mutateonekey?alt=proto&amp;key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk
  09-10 08:14:13.175  23045-23112/? E/AppInviteAgent﹕ Error communicating with server com.android.volley.AuthFailureError
  09-10 08:14:13.184     795-3345/? I/ActivityManager﹕ START u0 {act=android.intent.action.VIEW dat=https://plus.google.com/... flg=0x14000000 cmp=com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity} from uid 10011 on display 0
  09-10 08:14:13.266  23045-23081/? W/BaseAppContext﹕ Using Auth Proxy for data requests.
  09-10 08:14:13.307    1731-1731/? I/Keyboard.Facilitator﹕ onFinishInput()
  09-10 08:14:13.318      795-813/? I/ActivityManager﹕ Displayed com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity: +86ms
  09-10 08:14:13.343  23045-23082/? E/Surface﹕ getSlotFromBufferLocked: unknown buffer: 0xa96e4530
  09-10 08:14:13.387      795-804/? I/art﹕ Background partial concurrent mark sweep GC freed 604(43KB) AllocSpace objects, 0(0B) LOS objects, 30% free, 35MB/51MB, paused 3.115ms total 181.567ms
  09-10 08:14:13.480  23045-23092/? E/Volley﹕ [20359] BasicNetwork.performRequest: Unexpected response code 401 for https://www.googleapis.com/plusdatamixer/v1/mutateonekey?alt=proto&amp;key=AIzaSyAP-gfH3qvi6vgHZbSYwQ_XHqV_mXHhzIk
  09-10 08:14:13.481  23045-23081/? E/AppInviteAgent﹕ Error communicating with server com.android.volley.AuthFailureError
  09-10 08:14:13.491     795-1194/? I/ActivityManager﹕ START u0 {act=android.intent.action.VIEW dat=https://plus.google.com/... flg=0x14000000 cmp=com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity} from uid 10011 on display 0
  09-10 08:14:13.543  23045-23098/? W/BaseAppContext﹕ Using Auth Proxy for data requests.
  09-10 08:14:13.590    1731-1731/? I/Keyboard.Facilitator﹕ onFinishInput()
  09-10 08:14:13.609      795-813/? I/ActivityManager﹕ Displayed com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity: +80ms
  </code></pre>
  
  <p>More logs:</p>
  
  <pre><code>09-10 08:35:58.327    2148-2728/? E/MDM﹕ [145] b.run: Couldn't connect to Google API client: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null}
  09-10 08:35:58.332  19279-22527/? D/LocationInitializer﹕ Restart initialization of location
  09-10 08:35:58.335  22495-22495/? I/GAv4-SVC﹕ Google Analytics 7.9.53 is starting up.
  09-10 08:35:58.338     795-1268/? I/AccountManagerService﹕ getTypesVisibleToCaller: isPermitted? true
  09-10 08:35:58.355  22495-22526/? D/NativeLibraryUtils﹕ Install completed successfully.
  09-10 08:35:58.384  22495-22534/? D/OpenGLRenderer﹕ Use EGL_SWAP_BEHAVIOR_PRESERVED: true
  09-10 08:35:58.447  22495-22533/? W/BaseAppContext﹕ Using Auth Proxy for data requests.
  09-10 08:35:58.460  22495-22533/? I/GLSUser﹕ [ChannelManager] Attempting to channel bind connection HttpClient.
  09-10 08:35:58.467  22495-22534/? I/Adreno-EGL﹕ &lt;qeglDrvAPI_eglInitialize:379&gt;: QUALCOMM Build: 08/12/15, 70b1c55, I9e0bc0c0ce
  09-10 08:35:58.479  22495-22533/? I/GLSUser﹕ [ChannelManager] Checking whether channelId is enabled. isEnabledGmsCore? false, isEnabledSdk? true, isAtLeastKitKat? true
  09-10 08:35:58.484  22495-22534/? I/OpenGLRenderer﹕ Initialized EGL, version 1.4
  09-10 08:35:58.521    1731-1731/? I/Keyboard.Facilitator﹕ onFinishInput()
  09-10 08:35:58.539      795-813/? I/ActivityManager﹕ Displayed com.google.android.gms/.appinvite.AppInviteAcceptInvitationActivity: +368ms (total +399ms)
  09-10 08:35:58.597  22495-22537/? W/System.err﹕ java.lang.Exception: Error converting session
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.a.log(SourceFile:302)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.a.toSession(SourceFile:268)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.ClientSessionContext.getSession(SourceFile:87)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.SSLParametersImpl.getCachedClientSession(SourceFile:709)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.SSLParametersImpl.getSessionToReuse(SourceFile:376)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.OpenSSLSocketImpl.startHandshake(SourceFile:294)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.common.net.SSLCertificateSocketFactory.a(SourceFile:258)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.common.net.SSLCertificateSocketFactory.createSocket(SourceFile:558)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:89)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.Connection.connect(Connection.java:143)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:185)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:128)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:341)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:330)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:248)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:433)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:114)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:245)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.http.GoogleHttpClient.a(SourceFile:933)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.http.GoogleHttpClient.a(SourceFile:775)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:676)
  09-10 08:35:58.599  22495-22537/? W/System.err﹕ at com.google.android.gms.http.GoogleHttpClient.execute(SourceFile:660)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ at com.android.volley.toolbox.HttpClientStack.performRequest(SourceFile:87)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ at com.google.android.gms.auth.be.d.performRequest(SourceFile:43)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ at com.android.volley.toolbox.BasicNetwork.performRequest(SourceFile:96)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ at com.google.android.gms.common.server.v.performRequest(SourceFile:48)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ at com.android.volley.NetworkDispatcher.run(SourceFile:112)
  09-10 08:35:58.600  22495-22537/? W/System.err﹕ Caused by: java.io.IOException: Invalid session data
  09-10 08:35:58.603  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.OpenSSLSessionImpl.&lt;init&gt;(SourceFile:88)
  09-10 08:35:58.603  22495-22537/? W/System.err﹕ at com.google.android.gms.org.conscrypt.a.toSession(SourceFile:267)
  09-10 08:35:58.603  22495-22537/? W/System.err﹕ ... 27 more
  </code></pre>
  
  <p>Moreover - after a couple of hours it will start working for some time. Then it will stop.</p>
  
  <p>Config details:</p>
  
  <pre><code>dependencies {
      classpath 'com.android.tools.build:gradle:1.3'
      classpath 'com.google.gms:google-services:1.3.0'
  }
  //...
  compile 'com.google.android.gms:play-services-base:7.8.0'
  compile 'com.google.android.gms:play-services-appinvite:7.8.0'
  
  //...
  targetSdkVersion 22
  </code></pre>