public class MobilitySdk extends Object
Modifier and Type | Method and Description |
---|---|
ResponseFuture<Void> |
authenticateApplication(ApplicationAuthInfo authInfo)
Authenticates the application.
|
ResponseFuture<Boolean> |
forceLogsUpload()
Uploading now the SDK's logs.
|
String |
getApiKey()
Returns the developer's API key.
|
static MobilitySdk |
getInstance()
The singleton getInstance method.
|
String |
getLoggingId()
Returns a logging id.
|
UserPreferences |
getUserPreferences()
Returns the user preferences.
|
String |
getVersionName()
Returns the SDK version name.
|
static void |
init(Application app)
Call this method from your app's
Application.onCreate() method to initialize the SDK. |
static void |
init(Application app,
String apiKey)
Call this method from your app's
Application.onCreate() method to initialize the SDK |
boolean |
isHereAgentProcess()
Returns whether the current process is the SDK agent process.
|
static boolean |
isInitialized()
Checks if the MobilitySdk was initialized
|
boolean |
isUserVerified()
Is the current user is verified and eligible for operations that requires high
level of verification, such as booking a ride.
|
ResponseFuture<Void> |
sendVerificationEmail(String email)
Send verification Email to the given email, that contains a pin code.
|
ResponseFuture<Void> |
sendVerificationSms(String phone)
Send verification SMS to the given phone number, that contains a pin code.
|
void |
setUserPreferences(UserPreferences userPreferences)
Sets the SDK user preferences.
|
void |
userLogout()
Logs out the current verified user.
|
ResponseFuture<Void> |
verifyUserEmail(String email,
String pinCode)
Verifies the given email.
|
ResponseFuture<Void> |
verifyUserPhoneNumber(String phoneNumber,
String pinCode)
Verifies the given phone number.
|
public static MobilitySdk getInstance()
HereSdkInitializationException
- if called before calling MobilitySdk.init(android.app.Application)
public static void init(Application app)
Application.onCreate()
method to initialize the SDK.public static void init(Application app, String apiKey)
Application.onCreate()
method to initialize the SDKapp
- the application instanceapiKey
- api key to use. Will override the key in the manifest, if existspublic boolean isHereAgentProcess()
public String getVersionName()
public String getLoggingId()
public ResponseFuture<Void> authenticateApplication(ApplicationAuthInfo authInfo)
authInfo
- the auth info.ResponseFuture
that returns nothing in case of success, and contains the error
in case of failure.
This request can throw the following exceptions:
HMAuthInternalException
HMAuthException
public ResponseFuture<Void> sendVerificationSms(String phone)
MobilitySdk.verifyUserPhoneNumber(String, String)
with the given phone number and the pin code
to verify the phone number, and allow access to the demand marketplace.
This call will invalidate the previous validation (of either phone numebr or email).phone
- the phone number of the device. Should be in E.164 formatResponseFuture
that return nothing in case the SMS was sent successfully.
This request can throw the following exceptions:
HMAuthInvalidArgumentsException
in case of invalid phone number format
HMAuthInternalException
HMAuthException
public ResponseFuture<Void> sendVerificationEmail(String email)
MobilitySdk.verifyUserEmail(String, String)
with the given email and the pin code
to verify the email, and allow access to the demand marketplace.
This call will invalidate the previous validation (of either phone numebr or email).email
- the email of the user.ResponseFuture
that return nothing in case the email was sent successfully.
This request can throw the following exceptions:
HMAuthInvalidArgumentsException
in case of invalid email format
HMAuthInternalException
HMAuthException
public ResponseFuture<Void> verifyUserPhoneNumber(String phoneNumber, String pinCode)
MobilitySdk.sendVerificationSms(String)
and pass the pin code
received by the SMS message.
NOTE: MobilitySdk.authenticateApplication(ApplicationAuthInfo)
must be called before calling this
method.phoneNumber
- the phone number of the device. Should be in E.164 formatpinCode
- the pin code that was received by SMSResponseFuture
that holds exception in case of failure, and return nothing in
case the user was verified successfully.
This request can throw the following exceptions:
HMAuthInternalException
HMAuthException
public ResponseFuture<Void> verifyUserEmail(String email, String pinCode)
MobilitySdk.sendVerificationEmail(String)
and pass the pin code
received by the email message.
NOTE: MobilitySdk.authenticateApplication(ApplicationAuthInfo)
must be called before calling this
method.email
- the email of the user.pinCode
- the pin code that was received by emailResponseFuture
that holds exception in case of failure, and return nothing in
case the user was verified successfully.
This request can throw the following exceptions:
HMAuthInternalException
HMAuthException
public boolean isUserVerified()
MobilitySdk.verifyUserPhoneNumber(String, String)
public void userLogout()
MobilitySdk.verifyUserPhoneNumber(String, String)
or MobilitySdk.verifyUserEmail(String, String)
public static boolean isInitialized()
public String getApiKey()
public UserPreferences getUserPreferences()
public void setUserPreferences(UserPreferences userPreferences)
public ResponseFuture<Boolean> forceLogsUpload()