If you set the callback parameter on the getAuthToken() to null then
the method will block and wait and your activity's lifecycle isn't
interrupted. You can then get the bundle returned and if there is an
intent to ask show the grant credentials screen then you can manually
invoke it with startActivity or the other startActivityForResult.

I've just tried it on my app in the 4.0 emulator and if I disallow the
credentials screen (="no thanks"), nothing unexpected happens (other
than a crap load of strictmode exceptions).

HTH.

On Jan 2, 8:09 pm, Spiral123 <[email protected]> wrote:
> it gets stranger.
>
> In Honeycomb and earlier the app fires off the getAuthToken() request
> on another thread and then goes into onPause() whilst it waits for the
> authentication to happen asynchronously.
>
> In Ice Cream Sandwich the app goes into onPause(), then onStop() then
> onDestroy().  Then the app fires up an onCreate() again and launches a
> second authentication thread before the first has completed.
>
> I guess the lifecycle does stipulate that the activity should always
> be prepared to recreate itself cleanly in case the system destroys it
> - maybe ICS is more aggressive in doing that than previous versions of
> Android...any comments or experiences from anyone else?
>
> Also, I suppose I now need to look at SingleThreadExecutor to block
> unwanted additional auth requests being generated from the activity.
> Does anyone have any better ideas?
>
> all the best,
>
> Nick
>
> On Jan 2, 11:16 am, Spiral123 <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi all....
>
> > Just got my new Galaxy Nexus phone with ICS before New Years and have
> > been playing around with the old and new (in development) versions of
> > my app on it.
>
> > Whilst doing so, I've come across a problem that has me stumped: if I
> > call getAuthToken() in my app to authenticate a new account to my
> > Google API of choice and approve the request then everything works
> > fine.  If I disallow or hit the back key from the 'Permission request'
> > dialog then the app goes into a tailspin and eventually fails with a
> > leaked window.
>
> > I spent a couple of hours looking at this and as far as I can tell ICS
> > does not seem to be throwing the OperationCanceledException from the
> > system-generated Permissions request dialog as it should.
>
> > To verify the problem I've downloaded and replicated the issue with
> > the Android Picasa Sample and the google-meeting-scheduler.  The
> > projects are set to API Level 14 Build Target.
>
> > Has anyone else seen a similar behavior - or can anyone confirm that
> > they don't have the same problem with their apps?  I feel I must have
> > had too much turkey over xmas and my addled brain has missed something
> > obvious.
>
> > Nick

-- 
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

Reply via email to