diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java index c48e64161..6f72bcc27 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java @@ -5,6 +5,7 @@ import java.io.IOException; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AccountManagerFuture; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -85,7 +86,10 @@ public class GtasksTokenValidator { token = result.getString(AccountManager.KEY_AUTHTOKEN); } else if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = (Intent) result.get(AccountManager.KEY_INTENT); - c.startActivity(intent); + if (c instanceof Activity) + c.startActivity(intent); + else + throw new GoogleTasksException(c.getString(R.string.gtasks_error_background_sync_auth)); return TOKEN_INTENT_RECEIVED; } else { throw new GoogleTasksException(c.getString(R.string.gtasks_error_accountManager)); diff --git a/astrid/res/values/strings-gtasks.xml b/astrid/res/values/strings-gtasks.xml index 2d4db8d20..9c3c3f65d 100644 --- a/astrid/res/values/strings-gtasks.xml +++ b/astrid/res/values/strings-gtasks.xml @@ -101,6 +101,8 @@ Error in your phone\'s account manager. Please log out and log back in from the Google Tasks settings. + + Error authenticating in background. Please try initiating a sync while Astrid is running.