Download SDK

Installing the SDK with Android Studio / Gradle

https://www.youtube.com/watch?v=A-ei5bG6fqM

To install the library inside Android Studio, you can simply declare it as dependency in your build.gradle file.

Just include it in your list of dependencies, make sure to use always the latest available version.

**dependencies** {
		**api** 'com.ringcaptcha.android:ringcaptcha:2.0.1'
}

Once you've updated your build.gradle file, you can force Android Studio to sync with your new configuration by clicking the "Sync Project with Gradle Files" icon at the top of the window. This should download the aar dependency at which point you'll have access to the RingCaptcha library.

Installing the SDK Manually

To embed the SDK just drag & drop the Android SDK library into your libs folder of your project on your favorite IDE.

This will copy the folder straight into your libs section, including the assets and res folders. You will need to merge the contents of the folders assets and res with your project's respective folders so the activity views can be loaded.

Once the SDK has been included in your app, add the following permissions, activities and SMS Broadcaster to your application AndroidManifest.xml file. The SMS Broadcaster (SMS_RECEIVED) will automatically read the SMS and throw an event with the PIN code.

//AndroidManifest.xml file to merge
**<?xml version="1.0" encoding="utf-8"?>**<manifest xmlns:android="<http://schemas.android.com/apk/res/android>"
    package="com.example.sampleapp"
    android:versionCode="1"
    android:versionName="1.0"
    android:hardwareAccelerated="true" >

    <uses-sdk
        android:minSdkVersion="7"
        android:targetSdkVersion="17" />
    
    *<!-- ringcaptcha sdk permissions -->*<uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_SMS" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.example.sampleapp.MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data
                    android:scheme="yourAppScheme"
                    android:host="ringcaptcha" />
            </intent-filter>
        </activity>
        
        *<!-- ringcaptcha sdk activities|receivers -->*<activity
            android:name="com.thrivecom.ringcaptcha.SetNumberActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
            android:windowSoftInputMode="stateVisible|adjustPan|adjustResize"
            android:screenOrientation="sensor">
        </activity>
        
        <activity
            android:name="com.thrivecom.ringcaptcha.HelpActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="sensor">
        </activity>
        <activity
            android:name="com.thrivecom.ringcaptcha.VerifyActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="sensor">
        </activity>
        <activity
            android:name="com.thrivecom.ringcaptcha.CountryListActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="sensor">
        </activity>
        
         <activity
            android:name="com.thrivecom.ringcaptcha.OnboardActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="sensor">
        </activity>
        
        <activity
            android:name="com.thrivecom.ringcaptcha.CodeActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="sensor"
            android:windowSoftInputMode="stateVisible|adjustPan|adjustResize">
        </activity>
        
        <receiver
            android:name="com.thrivecom.ringcaptcha.RingcaptchaAPIController"
            android:enabled="true"
            android:exported="true" >
            <intent-filter android:priority="999">
                <action
                    android:name="android.provider.Telephony.SMS_RECEIVED"
                    android:scheme="sms" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

Download Android SDK now

Launching an Onboarding widget

To use the one screen onboarding process bundled into the SDK with the option of onboarding automatically from a website PIN, all you need to do is call the RingcaptchaApplication.onboard method as described below from any user action like starting the app for the first time when is not logged-in.

https://my.ringcaptcha.com/assets/images/docs/android-onboard-sms.png

https://my.ringcaptcha.com/assets/images/docs/android-onboard-pin.png

https://my.ringcaptcha.com/assets/images/docs/android-onboarded.png

On your initial Activity, in the method hooked to the user event add the following line of code.

RingcaptchaApplication.onboard(getApplicationContext(),"{{ app_key }}", "{{ secret_key }}", **new** RingcaptchaApplicationHandler() {
      @Override
      **public** **void** **onSuccess**(RingcaptchaVerification ringcaptchaVerification) {
          *//Verification successful*
      }
      @Override
      **public** **void** **onCancel**() {
          *//Decide what to do if user cancelled operation*
      }
  });

In the event the widget does not find an open session or is unable to attribute the onboarding process to a user, it will automatically start the verification process by asking the phone number to the user to send the PIN code to.