title: android GoogleAuthUtil.getTokenWithNotification Intent callback not triggering
body: <p>I have a background service that calls <code>GoogleAuthUtl.getTokenWithNotification</code> and it works properly but I'm trying to implement the callback portion of this function and that isn't working properly.</p>
  
  <p>I've implemented a broadcast receiver and added it to the manifest, I also have an activity in my app. Below are the relevant pieces of code.</p>
  
  <p><strong>GoogleAuthUtil.getTokenWithNotification</strong></p>
  
  <pre><code>GoogleAuthUtil.getTokenWithNotification(this.getContext(), account, "oauth2:" + GmailScopes.GMAIL_SEND, null, new Intent(AuthReceiver.AUTH_INTENT));
  </code></pre>
  
  <p><strong>AuthReceiver</strong></p>
  
  <pre><code>public class AuthReceiver extends BroadcastReceiver
  {
      public final static String AUTH_INTENT = "com.testoauth.AUTH_INTENT";
  
      public AuthReceiver()
      {
      }
  
      @Override
      public void onReceive(Context context, Intent intent)
      {
          Log.d("RECEIVER", "Received Auth broadcast.");
          NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
          notificationManager.cancelAll();
      }
  }
  </code></pre>
  
  <p><strong>AndroidManifest</strong></p>
  
  <pre><code>&lt;receiver android:name=".AuthReceiver" android:enabled="true" android:exported="true"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="com.testoauth.AUTH_INTENT" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>I have no clue why it is not receiving the broadcast. I don't see any exceptions in the logs and no indication that the receiver was called at all, it won't even break on a breakpoint when debugging. Am I doing something incorrectly?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I'm using min sdk 16 and target sdk 25</p>
  
  <p>From the <a href="https://developers.google.com/android/reference/com/google/android/gms/auth/GoogleAuthUtil.html#getTokenWithNotification(android.content.Context,%20android.accounts.Account,%20java.lang.String,%20android.os.Bundle,%20android.content.Intent)" rel="noreferrer">GoogleAuthUtil.getTokenWithNotification</a> API documentation:</p>
  
  <blockquote>
    <p>This method is specifically provided for background tasks. In the
    event of an error that needs user intervention, this method takes care
    of pushing relevant notification. After the user addresses the
    notification, the callback is broadcasted. If the user cancels then
    the callback is not fired.</p>
  </blockquote>
  
  <p>The callback is not fired regardless of the user canceling or not. Aside from the <code>ActivityManager</code> saying the notification has been displayed (<code>Displayed com.google.android.gms/.auth.uiflows.gettoken.GetTokenActivity</code>), there is no indication that the specified broadcast intent (in this case <code>com.testoauth.AUTH_INTENT</code>) has been sent in the logs. The "Received Auth broadcast." message is also absent from the logs.</p>
  
  <p>The included SDK example of this functionality (<code>&lt;android-sdk&gt;/extras/google/google_play_services/samples/auth/gau</code>) doesn't even work.</p>