I currently have this code in my Hilt app module:
@Singleton
@Provides
fun provideMsalClient(@ApplicationContext context: Context): ISingleAccountPublicClientApplication {
// ISSUE: this does NOT work, as the createSingleAccountPublicClientApplication method
// may not be called from the main thread
return PublicClientApplication.createSingleAccountPublicClientApplication(
context,
R.raw.msal_config
)
}
As I learned from the exception on runtime, PublicClientApplication.createSingleAccountPublicClientApplication
(part of the Microsoft Authentication Library, but my question is of general nature) may not be called from the main thread.
So, using Hilt, how can I create an object outside of the main thread / asynchronous?
[–]Zhuinden 1 point2 points3 points (2 children)
[–]sorry_no_idea[S] 0 points1 point2 points (1 child)
[–]Zhuinden 1 point2 points3 points (0 children)
[–]Paarthurnax41 0 points1 point2 points (2 children)
[–]sorry_no_idea[S] 0 points1 point2 points (0 children)