Did you ever find a resolution for this? I'm seeing the same behavior in
the dredit sample Drive SDK code, and my code based off of it. I create a
pending intent out of the intent returned from getIntent(), but it doesn't
launch.
Here is my code, taken directly from the sample:
try {
GoogleAccountCredential credential =
GoogleAccountCredential.usingOAuth2(mContext, DriveScopes.DRIVE_FILE);
credential.setSelectedAccountName(mAccount.name);
// Trying to get a token right away to see if we are authorized
credential.getToken();
mService = new Drive.Builder(AndroidHttp.newCompatibleTransport(),
new GsonFactory(), credential).build();
} catch (UserRecoverableAuthException e) {
Log.e("Failed to get token");
// If the exception is User Recoverable, we display a notification that
will trigger the
// intent to fix the issue.
Log.e("Notifying with intent: " + e.getIntent().toString());
NotificationManager notificationManager = (NotificationManager) mContext
.getSystemService(Context.NOTIFICATION_SERVICE);
Intent authorizationIntent = e.getIntent();
authorizationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).addFlags(
Intent.FLAG_FROM_BACKGROUND);
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0,
authorizationIntent, 0);
Notification notification = new Notification.Builder(mContext)
.setSmallIcon(android.R.drawable.ic_dialog_alert)
.setTicker("Permission requested")
.setContentTitle("Permission requested")
.setContentText("for account " + mAccount.name)
.setContentIntent(pendingIntent).setAutoCancel(true).build();
notificationManager.notify(0, notification);
} catch (Exception e) {
e.printStackTrace();
}
On Monday, March 11, 2013 3:05:48 AM UTC-5, Goddchen wrote:
>
> I'm having issues with the Google Drive SDK for Android.
>
> Everything works fine except for some devices (on which it used to be
> working, but now doesn't) the Intent that is returned by
> `UserRecoverableAuthException.getIntent()` isn't doing anything when
> started via `startIntent(...)`.
>
> All I see on Logcat is:
>
> 03-11 08:31:19.692: INFO/ActivityManager(552): START u0 {cat=[scope:oauth2:
>> https://www.googleapis.com/auth/drive,account:[email protected],extrashash:1088740320]
>>
>> flg=0x10000004 cmp=com.google.android.gms/.auth.TokenActivity (has extras)}
>> from pid 27644
>
>
> That's it. Nothing happens on the device.
>
> This is how the Intent is launched:
>
> Intent intent = e.getIntent();
>>
>> intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK).addFlags(Intent.FLAG_FROM_BACKGROUND);
>> startActivity(intent);
>
>
> Any ideas?
>
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.