Service not registered issue when using the don't keep activities flag
See original GitHub issueHi,
I’m having some issues when setting the “Don’t keep activities” flag to true. Everything works just fine if I disable the flag.
I’m using the microsoftMsalIdentityClient : 'com.microsoft.identity.client:msal:0.2.1'
version and I’m injecting the PublicClientApplication
through Dagger:
@Provides
@Singleton
fun providePublicClientApplication(context: Context): PublicClientApplication {
return PublicClientApplication(
context,
IDaaSConfiguration.CLIENT_ID,
String.format(
IDaaSConfiguration.AUTHORITY,
IDaaSConfiguration.TENANT, IDaaSConfiguration.SISU_POLICY)
)
}
This is my stacktrace:
Process: com.sarasa.sarasa, PID: 19916
java.lang.RuntimeException: Unable to resume activity {com.sarasa.sarasa/com.sarasa.sarasa.iris.ui.login.LoginActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=2003, data=Intent { (has extras) }} to activity {com.sarasa.sarasa/com.sarasa.sarasa.iris.ui.login.LoginActivity}: java.lang.IllegalArgumentException: Service not registered: com.microsoft.identity.common.internal.ui.browser.CustomTabsManager$1@2b9e2ff
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4221)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4323)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
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)
Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=2003, data=Intent { (has extras) }} to activity {com.sarasa.sarasa/com.sarasa.sarasa.iris.ui.login.LoginActivity}: java.lang.IllegalArgumentException: Service not registered: com.microsoft.identity.common.internal.ui.browser.CustomTabsManager$1@2b9e2ff
at android.app.ActivityThread.deliverResults(ActivityThread.java:4998)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4207)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4323)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
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)
Caused by: java.lang.IllegalArgumentException: Service not registered: com.microsoft.identity.common.internal.ui.browser.CustomTabsManager$1@2b9e2ff
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1160)
at android.app.ContextImpl.unbindService(ContextImpl.java:1475)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:644)
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)
at com.sarasa.sarasa.iris.ui.login.presenter.LoginPresenterImpl.handleInteractiveRequestRedirect(LoginPresenterImpl.kt:71)
at com.sarasa.sarasa.iris.ui.login.LoginActivity.onActivityResult(LoginActivity.kt:145)
at android.app.Activity.dispatchActivityResult(Activity.java:7165)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4994)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4207)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4323)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3426)
at android.app.ActivityThread.access$1100(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
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)
Any ideas why this could be happening? It’s a known issue?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
What is "Don't Keep Activities" in Android? - GeeksforGeeks
This means that the Android has to load the app's resources every time the user opens as it does not have the cached...
Read more >android - Don't keep activities - What is it for? - Stack Overflow
I believe it's a feature used for debugging purpose. From the Titanium doc: Don't keep activities under the Developer Options menu.
Read more >Service | Android Developers
The Android system will attempt to keep the process hosting a service around as ... Flag for bindService(Intent, ServiceConnection, int) : don't allow...
Read more >Shortcut to Don't Keep Activity Simulation | by Elye - Medium
To get that on, one has to enable the Developer Options (tap 7 times in the Build Number), then go and turn on...
Read more >Selective Service | USAGov
Learn how a military draft works and find out if and how you need to register for Selective Service. The Draft. A draft...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@4gus71n Yes it is working. But in this version you are unfortunately forced to use Chrome.
Dupe of https://github.com/AzureAD/microsoft-authentication-library-common-for-android/issues/353
Closing to track there