Email Verification

Depending on your flow, when a user registers with your application they will need to verify their email. The user does this by opening a link in an email to a web page that you host. The web page accepts a code from the email and verifies the user’s email address using Janrain’s javascript widget. The user experience can be improved by launching your application and displaying a friendly greeting upon successful email verification. This guide will walk through the steps to do that.

Setup a custom url scheme for your application

Modify the activity in your AndroidManifest.xml that you want to launch when the link is clicked (MainActivity, for example.)

        <!-- Make sure the activity is exported -->
        <activity android:name=".MainActivity" android:exported="true">

                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>

            <!-- New intent filter for launching this activity from a url -->
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="http" android:host="" android:path="/verified"/>


Note: should refer to a web page that you host. This page will be loaded if your application is not installed and could have content suggesting that the user download your android app.

In MainActivity (for example) add something like the following to onCreate.

        Intent intent = getIntent();
        Uri intent_uri = intent.getData();
        if (intent_uri != null && intent_uri.getPath().equals("/verified")) {
            AlertDialog.Builder b = new AlertDialog.Builder(MainActivity.this);
            b.setTitle("Welcome back " + intent_uri.getQuery());
            b.setMessage("Your email has been verified. Please sign in.");
            b.setNegativeButton("Cancel", null);
            b.setPositiveButton("Sign In", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    Jump.showSignInDialog(MainActivity.this, null, signInResultHandler, null);

Setup your web page

Your email verification page should be based on the “verify-email.html” file that was included in Janrain Capture widget deliverable that was provided to you by your Tech Lead.

In your Capture dashboard settings, set the verify_email_url to the address of your email verification page.

In the javascript function janrainCaptureWidgetOnLoad add the following before janrain.capture.ui.start();

                var userData = result.userData;

                if (userData) {
                    displayName = encodeURIComponent(userData.displayName);

                    if (navigator.userAgent.match(/iPad|iPhone|iPod/i)) {
                        window.location = 'your.custom.url.scheme:/verified?' + displayName;
                    } else if (navigator.userAgent.match(/Android/i)) {
                        window.location = '' + displayName;

When the email verification succeeds this will redirect the browser to your application.

Resending Email Verification

You may want to provide your users with the ability to resend the email verification in case they lost the original email or the verification code has expired. You can trigger this directly by calling Jump.resendEmailVerification(String, CaptureApiRequestCallback). If resending the email is successful then the onSuccess method of your callback will be invoked, otherwise the onFailure(CaptureApiError) method will be called. The generated email contains the url in the verify_email_url capture setting with a verification_code parameter appended.

For example the invocation in SimpleDemo looks like:

        Jump.resendEmailVerification(emailAddress, new CaptureApiRequestCallback() {

            public void onSuccess() {
                Toast.makeText(MainActivity.this, "Verification email sent.", Toast.LENGTH_LONG).show();

            public void onFailure(CaptureApiError e) {
                Toast.makeText(MainActivity.this, "Failed to send verification email: " + e,