Skip to content

Commit add6aaf

Browse files
committed
Forcing Yoti app to be opened when Yoti SDK button is pressed.
ED-545
1 parent 9988726 commit add6aaf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

yoti-sdk/src/main/java/com/yoti/mobile/android/sdk/kernelSDK/KernelSDKIntentService.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.security.NoSuchAlgorithmException;
1818
import java.security.cert.CertificateException;
1919

20+
import static com.yoti.mobile.android.sdk.YotiAppDefs.YOTI_APP_PACKAGE;
2021
import static com.yoti.mobile.android.sdk.YotiSDKDefs.APP_ID_PARAM;
2122
import static com.yoti.mobile.android.sdk.YotiSDKDefs.APP_NAME_PARAM;
2223
import static com.yoti.mobile.android.sdk.YotiSDKDefs.CALLBACK_PARAM;
@@ -123,7 +124,16 @@ private void handleActionStartScenario(String useCaseId) {
123124
.appendQueryParameter(APP_NAME_PARAM, appName)
124125
.build();
125126

126-
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
127+
Intent intent;
128+
intent = getPackageManager().getLaunchIntentForPackage(YOTI_APP_PACKAGE);
129+
130+
if (intent == null) {
131+
// Yoti app is not installed, let's open the website
132+
intent = new Intent(Intent.ACTION_VIEW, uri);
133+
} else {
134+
intent.setData(uri);
135+
}
136+
127137
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
128138
startActivity(intent);
129139
}

0 commit comments

Comments
 (0)