public class TrustDefender extends Object
TrustDefender sdk = TrustDefender.getInstance();
sdk.init(new Config().setOrgId("my_orgId").setContext(getApplicationContext());
sdk.doProfileRequest(new EndNotifier(){ public void complete(final ProfilingResult result) {} });
See the user guide for more information.Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel any in progress async profiling request.
|
boolean |
doPackageScan(int timeout)
Starts a scan of all packages.
|
THMStatusCode |
doProfileRequest(EndNotifier endNotifier)
Initiates a profiling request using the default fingerprint server and options.
|
THMStatusCode |
doProfileRequest(ProfilingOptions options)
Initiates a profiling request using the options supplied.
|
THMStatusCode |
doProfileRequest(String sessionID,
EndNotifier endNotifier)
Initiates a profiling request using the options supplied.
|
static TrustDefender |
getInstance() |
ProfilingResult |
getResult()
Gets the outcome of the most recent profiling request
|
THMStatusCode |
init(Config config)
This must be called once at start up, and performs the various one time initialisations
that can be slow.
|
THMStatusCode |
init(Context context,
String orgId)
This must be called once at start up, and performs the various one time initialisations
that can be slow.
|
void |
pauseLocationServices(boolean pause)
Temporarily disable/enable location services.
|
public static final String version
public static TrustDefender getInstance()
public THMStatusCode init(Context context, String orgId)
Note that this call returns immediately, but the initialisation process will continue in the back ground. Any doProfile() call that is made before initialisation is complete, will wait until completion before proceeding
Equivalent to the following:
init(new Config().setContext(context).setOrgId(orgId));
context
- The application ContextorgId
- The OrgId received from the ThreatMetrix team.THMStatusCode
for the complete list of return values.TrustDefenderStandardV4.init(Config)
public THMStatusCode init(Config config)
config
- An instance of Config
class which provide advanced control of TrustDefender
behaviour.THMStatusCode
for the complete list of return values.Config
,
THMStatusCode
public THMStatusCode doProfileRequest(EndNotifier endNotifier)
The call will return immediately, and, providing it returns THM_OK, will have started a background thread that performs the processing. Once this background thread completes, the completion notifier will be called, and profiling status can be checked at that point.
Equivalent to the following:
doProfileRequest(new ProfilingOptions().setEndNotifier(endNotifier));
endNotifier
- an instance of a class which implements EndNotifier
and is
called when the profiling request is completedTHMStatusCode
for the complete list of return values.TrustDefenderStandardV4.doProfileRequest(ProfilingOptions)
public THMStatusCode doProfileRequest(String sessionID, EndNotifier endNotifier)
Equivalent to the following:
doProfileRequest(new ProfilingOptions().setSessionID("my sessionid").setEndNotifier(endNotifier));
sessionID
- unique session id for this profile requestendNotifier
- an instance of a class which implements EndNotifier
and is called when the profiling request is completedTHMStatusCode
for the complete list of return values.TrustDefenderStandardV4.doProfileRequest(ProfilingOptions)
public THMStatusCode doProfileRequest(ProfilingOptions options)
options
- extra profiling data / optionsTHMStatusCode
for the complete list of return values.ProfilingOptions
public ProfilingResult getResult()
public boolean doPackageScan(int timeout)
timeout
- maximum number of milliseconds to spend scanning or 0 to disable the timeout.
If this value is too small, it may limit the number of packages visible to the SDKpublic void pauseLocationServices(boolean pause)
pause
- Indicates if we should pause or continue location servicespublic void cancel()