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

Please resolve "Service not registered problem" #353

Open
MichalDanielDobrzanski opened this issue Jan 30, 2019 · 4 comments
Open

Please resolve "Service not registered problem" #353

MichalDanielDobrzanski opened this issue Jan 30, 2019 · 4 comments
Assignees
Labels
Bug - P2 A problem that needs to be fixed for a feature to function as intended Issue Triage The engineering team has looked into the issue, understood the issue, labelled/classified the issue More Info Additional information is required to diagnose, troubleshoot, or confirm

Comments

@MichalDanielDobrzanski
Copy link
Contributor

MichalDanielDobrzanski commented Jan 30, 2019

Occurred on Sony Xperia phone with Android 6.0.
Also probably when user sets "Don't keep activities" flag.
This looks like a simple case, when we want to unbind(), but we don't have active service connection running.

AzureAD/microsoft-authentication-library-for-android#454

@MichalDanielDobrzanski
Copy link
Contributor Author

IllegalArgumentException: Service not registered: com.microsoft.identity.common.internal.ui.browser.CustomTabsManager$1@c4355ab
        at android.app.ActivityThread.deliverResults(ActivityThread.java:3798)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3146)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3191) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2529) 
        at android.app.ActivityThread.access$900(ActivityThread.java:154) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:234) 
        at android.app.ActivityThread.main(ActivityThread.java:5524) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
     Caused by: java.lang.IllegalArgumentException: Service not registered: com.microsoft.identity.common.internal.ui.browser.CustomTabsManager$1@c4355ab
        at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1048)
        at android.app.ContextImpl.unbindService(ContextImpl.java:1323)
        at android.content.ContextWrapper.unbindService(ContextWrapper.java:616)
        at com.microsoft.identity.common.internal.ui.browser.CustomTabsManager.unbind(CustomTabsManager.java:138)
        at com.microsoft.identity.common.internal.ui.browser.BrowserAuthorizationStrategy.dispose(BrowserAuthorizationStrategy.java:132)
        at com.microsoft.identity.common.internal.ui.browser.BrowserAuthorizationStrategy.completeAuthorization(BrowserAuthorizationStrategy.java:114)
        at com.microsoft.identity.client.internal.controllers.LocalMSALController.completeAcquireToken(LocalMSALController.java:235)
        at com.microsoft.identity.client.internal.controllers.MSALInteractiveTokenCommand.notify(MSALInteractiveTokenCommand.java:68)
        at com.microsoft.identity.client.internal.controllers.MSALApiDispatcher.completeInteractive(MSALApiDispatcher.java:244)
        at com.microsoft.identity.client.PublicClientApplication.handleInteractiveRequestRedirect(PublicClientApplication.java:412)

@MichalDanielDobrzanski
Copy link
Contributor Author

The case is can be that you are binding Service to Activity's context, not Application context and you are creating multiple instances of ServiceConnection on bind(), while previous can live.

I've used Activity context and I was not able to reproduce this error.

!CustomTabsClient.bindCustomTabsService(mActivityRef.get().getApplicationContext(), browserPackage, mCustomTabsServiceConnection))

And:

mActivityRef.get().getApplicationContext().unbindService(mCustomTabsServiceConnection);

@iambmelt
Copy link
Member

@MichalDanielDobrzanski Are you still having this issue with the 1.1.0 release?

@iambmelt iambmelt added Bug - P2 A problem that needs to be fixed for a feature to function as intended Issue Triage The engineering team has looked into the issue, understood the issue, labelled/classified the issue More Info Additional information is required to diagnose, troubleshoot, or confirm labels Dec 19, 2019
@MichalDanielDobrzanski
Copy link
Contributor Author

@iambmelt I am not able to test it since I don't own this device anymore. AFAIK, you have merged my PR with proposed solution. I would try to retest this with "Don't keep activities"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug - P2 A problem that needs to be fixed for a feature to function as intended Issue Triage The engineering team has looked into the issue, understood the issue, labelled/classified the issue More Info Additional information is required to diagnose, troubleshoot, or confirm
Projects
None yet
Development

No branches or pull requests

3 participants