In the example you are using AcquireTokenFragment
it has acquireTokenCallback
which is passed MsalWrapper
which wrapps it with AuthenticationCallback
This is very bad code practice in android development - you are leaking fragment which MAY BE DEAD after code from this library (MAY AND WILL BE DEAD - if you enable "Don't keep activities" - and callback will be called on not atached dead fragment/activity)
Proper flow should be using Activity/Fragment.startActivityForResult
/registerForActivityResult
for IPublicClientApplication.acquireToken
and ISingleAccountPublicClientApplication.signIn
(and other functions which starts new activity)
It is ok for acquireTokenSilent
to use callback since it doesn't start new activity