public final class TruecallerSDK
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
clear() |
static TruecallerSDK |
getInstance()
Must call
TruecallerSDK#init(Context, ProfileCallback) to initialize the instance,
otherwise this method will throw exception |
void |
getUserProfile(Fragment fragment)
This is same as
TruecallerSDK#getUserProfile(Activity), except that it accepts fragment. |
void |
getUserProfile(FragmentActivity activity)
This is the method to be called to get the user verified.
|
static void |
init(android.content.Context context,
ITrueCallback callback)
Deprecated.
Use
init(TruecallerSdkScope) instead.
This method has to be called before you can use |
static void |
init(TruecallerSdkScope trueScope)
This method has to be called before you can use
TruecallerSDK#getUserProfile(Activity) and other methods. |
boolean |
isUsable() |
boolean |
onActivityResultObtained(FragmentActivity activity,
int resultCode,
android.content.Intent data)
Make sure
Activity.onActivityResult(int, int, Intent) of your Activity calls
this method and passes the intent and resultCode. |
void |
requestVerification(java.lang.String countryISO,
java.lang.String phoneNumber,
VerificationCallback callback,
FragmentActivity activity)
This method will initiate a verification asynchronously.
|
void |
setLocale(java.util.Locale locale)
Call this to set locale
|
void |
setRequestNonce(java.lang.String requestNonce)
Set a nonce for the next request, which will be passed back with the verification result.
|
void |
setTheme(int theme)
Call this to set theme
|
void |
updateCallback(ITrueCallback trueCallback)
Helper method to update the main callback
ITrueCallback, that receives profile information at different point
than only during initialization. |
void |
verifyMissedCall(TrueProfile trueProfile,
VerificationCallback callback)
If the number has to be verified with a missed call on that number,
call this method to complete verification asynchronously, after receiving success in
VerificationCallback#onRequestSuccess(int, String). |
void |
verifyOtp(TrueProfile trueProfile,
java.lang.String otp,
VerificationCallback callback)
If the number has to be verified with an OTP, after receiving the code via SMS,
call this method to complete verification asynchronously.
|
@Deprecated
public static void init(android.content.Context context,
ITrueCallback callback)
throws java.lang.RuntimeException
init(TruecallerSdkScope) instead.
This method has to be called before you can use TruecallerSDK#getUserProfile(Activity) and other methods.
SDK methods will have undesirable behaviour otherwise.
context, - can be Application contextcallback, - see ProfileCallback for more infoshowConsentInFullScreen, - boolean to decide whether to show the confirm profile popup in full-screen
or as a dialogRuntimeException, - if partner key is not added in the manifest filejava.lang.RuntimeExceptionpublic static void init(TruecallerSdkScope trueScope)
TruecallerSDK#getUserProfile(Activity) and other methods.
SDK methods will have undesirable behaviour otherwise.trueScope, - Scope to define on the features of sdk to usepublic static TruecallerSDK getInstance() throws java.lang.RuntimeException
TruecallerSDK#init(Context, ProfileCallback) to initialize the instance,
otherwise this method will throw exceptionTruecallerSDK instance to request SDK operationsjava.lang.RuntimeExceptionpublic boolean isUsable()
public void setRequestNonce(java.lang.String requestNonce)
requestNonce - - must be min length: 8, max length: 64 bas64 URL safe string .public void updateCallback(ITrueCallback trueCallback)
ITrueCallback, that receives profile information at different point
than only during initialization.trueCallback, - callback to setpublic void getUserProfile(FragmentActivity activity)
Make sure Activity.onActivityResult(int, int, Intent) of your Activity calls
TruecallerSDK#onActivityResultObtained(Activity, int, Intent)
activity, - which will receive the activity result, if Truecaller is installedpublic void getUserProfile(Fragment fragment)
TruecallerSDK#getUserProfile(Activity), except that it accepts fragment.
Make sure Activity.onActivityResult(int, int, Intent) of your Activity calls
TruecallerSDK#onActivityResultObtained(Activity, int, Intent)fragment, - which will receive the activity result, if Truecaller is installedpublic boolean onActivityResultObtained(FragmentActivity activity,
int resultCode,
android.content.Intent data)
Activity.onActivityResult(int, int, Intent) of your Activity calls
this method and passes the intent and resultCode.activity - parent activity which requested the profileresultCode - resultCode from Activity.onActivityResult(int, int, Intent)data - intent from Activity.onActivityResult(int, int, Intent)public void requestVerification(java.lang.String countryISO,
java.lang.String phoneNumber,
VerificationCallback callback,
FragmentActivity activity)
VerificationCallback interface.
Check documentation for VerificationCallback to understand the flow and different verifications states.
This method may lead to verification with a SMS Code (OTP) or verification with a CALL,
or if the user is already verified on the device, will get the call back in
ProfileCallback#onSuccessProfileShared(TrueProfile).
countryISO - pass the countrycode in ISO format eg: "IN" for India.phoneNumber - the phone number to be verified (local, without country code)callback - VerificationCallback which will return the result of the verification.public void verifyOtp(TrueProfile trueProfile, java.lang.String otp, VerificationCallback callback)
VerificationCallback as passed with
TruecallerSDK#requestVerification(String, String, VerificationCallback)trueProfile - To complete verification it is mandatory to pass a newly created TrueProfile object
of the current (verifying) user.
The profile should at least contain, TrueProfile.firstName
and TrueProfile.lastName filled.otp - the code received over SMScallback - the call back to which verification result has to be passedpublic void verifyMissedCall(TrueProfile trueProfile, VerificationCallback callback)
VerificationCallback#onRequestSuccess(int, String).
with request type VerificationCallback#TYPE_MISSED_CALL_RECEIVED
The method will take the same callback interface VerificationCallback as passed with
TruecallerSDK#requestVerification(String, String, VerificationCallback)trueProfile - To complete verification it is mandatory to pass a newly created TrueProfile object
of the current (verifying) user.
The profile should at least contain, TrueProfile.firstNamex
and TrueProfile.lastName filled.callback - the call back to which verification result has to be passedpublic void setLocale(java.util.Locale locale)
locale - Locale to set topublic void setTheme(int theme)
theme - Pass theme from one of the values in SdkThemeOptionspublic static void clear()