#StackBounty: #android #google-play-services #google-oauth #google-authentication #android-broadcastreceiver android GoogleAuthUtil.get…

Bounty: 500

I have a background service that calls GoogleAuthUtl.getTokenWithNotification and it works properly but I’m trying to implement the callback portion of this function and that isn’t working properly.

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.


GoogleAuthUtil.getTokenWithNotification(this.getContext(), account, "oauth2:" + GmailScopes.GMAIL_SEND, null, new Intent(AuthReceiver.AUTH_INTENT));


public class AuthReceiver extends BroadcastReceiver
    public final static String AUTH_INTENT = "com.testoauth.AUTH_INTENT";

    public AuthReceiver()

    public void onReceive(Context context, Intent intent)
        Log.d("RECEIVER", "Received Auth broadcast.");
        NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);


<receiver android:name=".AuthReceiver" android:enabled="true" android:exported="true">
        <action android:name="com.testoauth.AUTH_INTENT" />

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?


I’m using min sdk 15 and target sdk 22

From the GoogleAuthUtil.getTokenWithNotification API documentation:

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.

The callback is not fired regardless of the user canceling or not. Aside from gcm saying the notification has been displayed, there is no indication that the specified broadcast intent has been sent in the logs.

Get this bounty!!!