Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public void onStartScenarioError(YotiSDKException cause) {
@Override
public void onYotiAppNotInstalledError(YotiSDKNoYotiAppException cause) {
//The Yoti app is not installed, let's deal with it
yotiSDKButton.setVisibility(View.VISIBLE);
progress.setVisibility(View.GONE);
message.setText(R.string.loc_no_yoti_app_error);
}
});

Expand Down
1 change: 1 addition & 0 deletions sample-app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<string name="share_my_phone">Share my phone</string>

<string name="loc_error_unknow">Something went wrong :(</string>
<string name="loc_no_yoti_app_error">The Yoti app is not install in this device</string>
<string name="loc_error_not_completed_on_yoti">Process not completed on the Yoti App</string>
<string name="loc_phone_number">Your phone number is : %s</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ public void onClick(View v) {

YotiSDKLogger.error(cause.getMessage(), cause);

if (mOnYotiButtonClickListener != null) {
mOnYotiButtonClickListener.onStartScenarioError(cause);
}

if (mOnYotiAppNotInstalledListener != null && cause instanceof YotiSDKNoYotiAppException) {
mOnYotiAppNotInstalledListener.onYotiAppNotInstalledError((YotiSDKNoYotiAppException) cause);
} else if (mOnYotiButtonClickListener != null) {
mOnYotiButtonClickListener.onStartScenarioError(cause);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;

import static com.yoti.mobile.android.sdk.YotiAppDefs.YOTI_APP_PACKAGE;
import static com.yoti.mobile.android.sdk.YotiSDKDefs.APP_ID_PARAM;
import static com.yoti.mobile.android.sdk.YotiSDKDefs.APP_NAME_PARAM;
import static com.yoti.mobile.android.sdk.YotiSDKDefs.CALLBACK_PARAM;
Expand Down Expand Up @@ -129,7 +130,16 @@ private void handleActionStartScenario(String useCaseId, ResultReceiver resultRe

resultReceiver.send(0, null);

Intent intent = new Intent(Intent.ACTION_VIEW, uri);
Intent intent;
intent = getPackageManager().getLaunchIntentForPackage(YOTI_APP_PACKAGE);

if (intent == null) {
// Yoti app is not installed, let's open the website
intent = new Intent(Intent.ACTION_VIEW, uri);
} else {
intent.setData(uri);
}

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
Expand Down