Search in sources :

Example 1 with IBrokerResultAdapter

use of com.microsoft.identity.common.internal.result.IBrokerResultAdapter in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerActivity method returnsExceptionOnActivityUnexpectedlyKilled.

private void returnsExceptionOnActivityUnexpectedlyKilled() {
    final IBrokerResultAdapter resultAdapter = BrokerResultAdapterFactory.getBrokerResultAdapter(SdkType.MSAL);
    final Bundle resultBundle = resultAdapter.bundleFromBaseException(new ClientException(ErrorStrings.BROKER_REQUEST_CANCELLED, "The activity is killed unexpectedly."), null);
    final Intent data = new Intent();
    data.putExtras(resultBundle);
    data.setAction(RETURN_INTERACTIVE_REQUEST_RESULT);
    data.putExtra(REQUEST_CODE, AuthenticationConstants.UIRequest.BROWSER_FLOW);
    data.putExtra(RESULT_CODE, AuthenticationConstants.UIResponse.BROWSER_CODE_CANCEL);
    LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(data);
}
Also used : IBrokerResultAdapter(com.microsoft.identity.common.internal.result.IBrokerResultAdapter) Bundle(android.os.Bundle) Intent(android.content.Intent) ClientException(com.microsoft.identity.common.exception.ClientException)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 ClientException (com.microsoft.identity.common.exception.ClientException)1 IBrokerResultAdapter (com.microsoft.identity.common.internal.result.IBrokerResultAdapter)1