33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/javadoc/package-list: -------------------------------------------------------------------------------- 1 | com.nexmo.sdk 2 | com.nexmo.sdk.core.client 3 | com.nexmo.sdk.core.config 4 | com.nexmo.sdk.core.device 5 | com.nexmo.sdk.core.event 6 | com.nexmo.sdk.core.gcm 7 | com.nexmo.sdk.core.request 8 | com.nexmo.sdk.util 9 | com.nexmo.sdk.verify.client 10 | com.nexmo.sdk.verify.core.event 11 | com.nexmo.sdk.verify.core.event.token 12 | com.nexmo.sdk.verify.core.request 13 | com.nexmo.sdk.verify.core.response 14 | com.nexmo.sdk.verify.core.service 15 | com.nexmo.sdk.verify.event 16 | -------------------------------------------------------------------------------- /docs/javadoc/resources/background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/docs/javadoc/resources/background.gif -------------------------------------------------------------------------------- /docs/javadoc/resources/tab.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/docs/javadoc/resources/tab.gif -------------------------------------------------------------------------------- /docs/javadoc/resources/titlebar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/docs/javadoc/resources/titlebar.gif -------------------------------------------------------------------------------- /docs/javadoc/resources/titlebar_end.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/docs/javadoc/resources/titlebar_end.gif -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | VERSION_NAME=1.0.0-SNAPSHOT 2 | VERSION_CODE=1 3 | GROUP=com.nexmo 4 | 5 | POM_DESCRIPTION=Nexmo Verify enables you to verify whether one of your end users has access to a specific phone number by challenging them with a PIN code to enter into your application. 6 | POM_URL=https://github.com/Nexmo/verify-android-sdk.git 7 | POM_SCM_URL=https://github.com/Nexmo/verify-android-sdk.git 8 | POM_SCM_CONNECTION=scm:git@github.com:Nexmo/verify-android-sdk.git 9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:Nexmo/verify-android-sdk.git 10 | 11 | POM_LICENCE_NAME=Nexmo Verify SDK License Agreement 12 | POM_LICENCE_URL=https://www.nexmo.com/terms-use/verify-sdk/ 13 | POM_LICENCE_DIST=repo 14 | 15 | POM_DEVELOPER_ID=Nexmo 16 | POM_DEVELOPER_NAME=Emma Tresanszki 17 | 18 | RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2 19 | SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 13 11:57:29 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':verifySDK' 2 | -------------------------------------------------------------------------------- /verifySDK/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | local.properties 3 | -------------------------------------------------------------------------------- /verifySDK/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Nexmo Verify Library 2 | POM_ARTIFACT_ID=verify 3 | POM_PACKAGING=aar 4 | -------------------------------------------------------------------------------- /verifySDK/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/verifySDK/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /verifySDK/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /verifySDK/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /verifySDK/libs/org.apache.http.legacy.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nexmo/verify-android-sdk/f095775a2915e55c770575751d942e0413f68412/verifySDK/libs/org.apache.http.legacy.jar -------------------------------------------------------------------------------- /verifySDK/src/androidTest/java/com/nexmo/sdk/NexmoClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Nexmo Inc 3 | * All rights reserved. 4 | * 5 | * Licensed only under the Nexmo Verify SDK License Agreement located at 6 | * 7 | * https://www.nexmo.com/terms-use/verify-sdk/ (the “License”) 8 | * 9 | * You may not use, exercise any rights with respect to or exploit this SDK, 10 | * or any modifications or derivative works thereof, except in accordance 11 | * with the License. 12 | */ 13 | 14 | package com.nexmo.sdk; 15 | 16 | import android.test.mock.MockContext; 17 | 18 | import com.nexmo.sdk.core.client.ClientBuilderException; 19 | import com.nexmo.sdk.core.config.Config; 20 | 21 | import org.junit.After; 22 | import org.junit.Before; 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.assertEquals; 26 | import static org.junit.Assert.assertTrue; 27 | 28 | public class NexmoClientTest { 29 | private static final String TAG = NexmoClientTest.class.getSimpleName(); 30 | private NexmoClient nexmoClient; 31 | 32 | @Before 33 | public void setUp() throws Exception { 34 | nexmoClient = new NexmoClient.NexmoClientBuilder() 35 | .context(new MockContext()) 36 | .applicationId("app_dummy") 37 | .sharedSecretKey("secret_dummy") 38 | .build(); 39 | } 40 | 41 | @After 42 | public void tearDown() throws Exception { 43 | nexmoClient = null; 44 | } 45 | 46 | @Test 47 | public void testGetSharedSecretKey() throws Exception { 48 | assertEquals(TAG + " testGetSharedSecretKey" , nexmoClient.getSharedSecretKey(), "secret_dummy"); 49 | } 50 | 51 | @Test 52 | public void testGetAppId() throws Exception { 53 | assertEquals(TAG + " testGetAppId", nexmoClient.getApplicationId(), "app_dummy"); 54 | } 55 | 56 | @Test 57 | public void testGetEnvironment() throws Exception { 58 | assertEquals(TAG + " testGetEnvironment", nexmoClient.getEnvironmentHost(), NexmoClient.ENVIRONMENT_HOST.PRODUCTION); 59 | } 60 | 61 | @Test 62 | public void expectedConfigNoAppId() throws Exception { 63 | try { 64 | new NexmoClient.NexmoClientBuilder() 65 | .context(new MockContext()) 66 | .sharedSecretKey("xyz") 67 | .build(); 68 | assertTrue(TAG + " expectedConfigNoAppId, did not throw exception.", false); 69 | } catch (ClientBuilderException exception) { 70 | assertTrue(TAG + " expectedConfigNoAppId", true); 71 | } 72 | } 73 | 74 | @Test 75 | public void expectedConfigNoSecretKey() throws Exception { 76 | try { 77 | new NexmoClient.NexmoClientBuilder().context(new MockContext()) 78 | .applicationId("app_dummy") 79 | .build(); 80 | assertTrue(TAG + " expectedConfigNoSecretKey, did not throw exception.", false); 81 | } catch (ClientBuilderException exception) { 82 | assertTrue(TAG + " expectedConfigNoSecretKey", true); 83 | } 84 | } 85 | 86 | @Test 87 | public void testGetVersion() throws Exception { 88 | assertEquals(TAG + " testGetVersion", nexmoClient.getVersion(), Config.SDK_REVISION_CODE); 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /verifySDK/src/androidTest/java/com/nexmo/sdk/core/client/ClientTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Nexmo Inc 3 | * All rights reserved. 4 | * 5 | * Licensed only under the Nexmo Verify SDK License Agreement located at 6 | * 7 | * https://www.nexmo.com/terms-use/verify-sdk/ (the “License”) 8 | * 9 | * You may not use, exercise any rights with respect to or exploit this SDK, 10 | * or any modifications or derivative works thereof, except in accordance 11 | * with the License. 12 | */ 13 | 14 | package com.nexmo.sdk.core.client; 15 | 16 | import com.nexmo.sdk.core.config.Config; 17 | import com.nexmo.sdk.core.device.DeviceProperties; 18 | import com.nexmo.sdk.verify.core.service.BaseService; 19 | import com.nexmo.sdk.verify.client.InternalNetworkException; 20 | import com.nexmo.sdk.verify.client.MockNexmoClient; 21 | 22 | import org.junit.Before; 23 | import org.junit.Test; 24 | 25 | import static org.junit.Assert.assertEquals; 26 | import static org.junit.Assert.assertNotNull; 27 | import static org.junit.Assert.assertTrue; 28 | 29 | import java.net.HttpURLConnection; 30 | import java.util.Map; 31 | import java.util.TreeMap; 32 | 33 | public class ClientTest { 34 | private static final String TAG = ClientTest.class.getSimpleName(); 35 | private Client client; 36 | private MockNexmoClient mockNexmoClient; 37 | private HttpURLConnection connection; 38 | Map
To register for receiving search events add the listener to the search 24 | * call {@link VerifyClient#getUserStatus(String, String, SearchListener)} 25 | *
Example usage: 26 | *
27 | * myVerifyClient.getUserStatus("GB", "070000000000", new SearchListener() { 28 | * @Override 29 | * public void onUserStatus(final UserStatus userStatus) { 30 | * // Update the application UI here if needed. 31 | * } 32 | * 33 | * @Override 34 | * public void onError(final com.nexmo.sdk.verify.event.VerifyError errorCode) { 35 | * // Update the application UI here if needed. 36 | * } 37 | * } 38 | *39 | */ 40 | public interface SearchListener extends GenericExceptionListener { 41 | 42 | /** 43 | * Indicates the current user status. 44 | * @param userStatus The user status, one of the following: 45 | * {@link UserStatus#USER_PENDING} 46 | * {@link UserStatus#USER_VERIFIED} 47 | * {@link UserStatus#USER_UNVERIFIED} 48 | * {@link UserStatus#USER_EXPIRED} 49 | * {@link UserStatus#USER_FAILED} 50 | * {@link UserStatus#USER_BLACKLISTED} 51 | * {@link UserStatus#USER_UNKNOWN} 52 | */ 53 | public void onUserStatus(final UserStatus userStatus); 54 | 55 | /** 56 | * The search request has been rejected. 57 | * @param errorCode The {@link VerifyError} codes to describe the error. 58 | * @param errorMessage The message that describes the {@link VerifyError}. 59 | */ 60 | public void onError(final com.nexmo.sdk.verify.event.VerifyError errorCode, 61 | final String errorMessage); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /verifySDK/src/main/java/com/nexmo/sdk/verify/event/UserObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Nexmo Inc 3 | * All rights reserved. 4 | * 5 | * Licensed only under the Nexmo Verify SDK License Agreement located at 6 | * 7 | * https://www.nexmo.com/terms-use/verify-sdk/ (the “License”) 8 | * 9 | * You may not use, exercise any rights with respect to or exploit this SDK, 10 | * or any modifications or derivative works thereof, except in accordance 11 | * with the License. 12 | */ 13 | 14 | package com.nexmo.sdk.verify.event; 15 | 16 | import android.os.Parcel; 17 | import android.os.Parcelable; 18 | 19 | /** 20 | * A {@link UserObject} contains all the information on the user which initiated a verify request. 21 | */ 22 | public class UserObject implements Parcelable { 23 | 24 | private String phoneNumber; 25 | 26 | public UserObject(final String phoneNumber){ 27 | this.phoneNumber = phoneNumber; 28 | } 29 | 30 | @Override 31 | public int describeContents() { 32 | return 0; 33 | } 34 | 35 | public static final Parcelable.Creator