Skip to content

Commit

Permalink
Fix for ActivityNotFoundException (closes #166) (#288)
Browse files Browse the repository at this point in the history
* Fix for ActivityNotFoundException (closes #166)

* Change RESULT_OK to RESULT_CANCELED
  • Loading branch information
davidvavra authored Oct 26, 2021
1 parent 490d35e commit 91f662c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.okta.oidc;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
Expand Down Expand Up @@ -278,7 +279,12 @@ public void onServiceConnected(String browserPackage, CustomTabsClient customTab
session = createSession(customTabsClient);
}
mAuthStarted = true;
startActivity(createBrowserIntent(browserPackage, session));
try {
startActivity(createBrowserIntent(browserPackage, session));
} catch (ActivityNotFoundException e) {
sendResult(RESULT_CANCELED, getIntent().putExtra(EXTRA_EXCEPTION,
AuthorizationException.GeneralErrors.NO_BROWSER_FOUND.toJsonString()));
}
}

/**
Expand Down

0 comments on commit 91f662c

Please sign in to comment.