Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when tried to login with a google account #153

Closed
Write4Dinesh opened this issue Jan 20, 2017 · 3 comments
Closed

Crash when tried to login with a google account #153

Write4Dinesh opened this issue Jan 20, 2017 · 3 comments

Comments

@Write4Dinesh
Copy link

Write4Dinesh commented Jan 20, 2017

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:734)
at android.app.ContextImpl.startActivity(ContextImpl.java:721)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:345)
at net.openid.appauth.AuthorizationService.performAuthorizationRequest(AuthorizationService.java:230)
at net.openid.appauth.AuthorizationService.performAuthorizationRequest(AuthorizationService.java:132)
at com.janrain.android.engage.OpenIDAppAuthGoogle.makeAuthRequest(OpenIDAppAuthGoogle.java:185)
at com.janrain.android.engage.OpenIDAppAuthGoogle.access$100(OpenIDAppAuthGoogle.java:64)
at com.janrain.android.engage.OpenIDAppAuthGoogle$1.onFetchConfigurationCompleted(OpenIDAppAuthGoogle.java:122)
at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.onPostExecute(AuthorizationServiceConfiguration.java:331)
at net.openid.appauth.AuthorizationServiceConfiguration$ConfigurationRetrievalAsyncTask.onPostExecute(AuthorizationServiceConfiguration.java:272)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.access$500(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
@iainmcgin
Copy link
Member

Reading the description line of the exception, it is possible you have provided a non-Activity context to the constructor of AuthorizationService.

@Write4Dinesh
Copy link
Author

Thanks for the reply. it is fixed

@juusoa
Copy link

juusoa commented Aug 18, 2017

I think there should be a way to construct AuthorizationService outside Activity context. This is needed when you want to use AuthorizationService from service, without UI. For example background synchronization is one of those usecases. Then you only have application context available.

Currently it is not possible to customize how Intent is create as it is static method in AuthorizationManagementActivity:
private static Intent createBaseIntent(Context context) { return new Intent(context, AuthorizationManagementActivity.class); }

Working temporary fix:
private static Intent createBaseIntent(Context context) { Intent intent = new Intent(context, AuthorizationManagementActivity.class); if (context == context.getApplicationContext()) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } return intent; }

But maybe it would be better to provide a way to customize how Intents is created.

Same kind of problem exist with threads:
#123
there exists a good plan to solve that problem. Similar solution is needed for this; applications need a way to customize Intent.

Would you consider to provide an option to customize how Intent is created?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants