Class DeviceAssure
- java.lang.Object
-
- com.deviceassure.android.library.networking.DeviceAssure
-
public class DeviceAssure extends java.lang.ObjectAPI client to use DeviceAssure library. The init() method needs to be called first in order for the data collection process to be initialized. Then the DeviceAssure check method can be called to get the Authenticity of the device.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheck(Callback callback, java.lang.String[] urls)[OnSite] Run device validation, only for apps that support Android API < 14.static voidcheck(Callback callback, java.net.URL[] urls)[OnSite] Run device validation, only for apps that support Android API < 14.static voidcheck(java.lang.String licence, Callback callback)[Cloud] Run device validation for apps that support Android API >= 14.static voidgetData(Callback customerCallback)[Server to Server] Run device validation for apps that support Android API >= 14.static voidinit(android.content.Context context)Initialize the DeviceAssure library.
-
-
-
Method Detail
-
init
public static void init(android.content.Context context)
Initialize the DeviceAssure library. This method needs to be called before any other method in the library is called. It initializes the data collection process.
public class SampleApplication extends Application { @Override public void onCreate() { super.onCreate(); DeviceAssure.init(this.getApplicationContext()); } }- Parameters:
context- The context of the application
-
check
public static void check(java.lang.String licence, Callback callback)[Cloud] Run device validation for apps that support Android API >= 14. The check method is called from a host application in order to start the device verification process. During validation the library will collect some data about the device and send to the DeviceAssure servers to process. Should an error occur during the sending and processing that library will attempt to retry the validation a number of times. After all the retries have been exhausted and not successful response returned the library will sent a
'Failed to connect'message back via the handleError callback method. In the case where the device has no internet connectivity, a'No Internet Connection'message will be returned via the handleError callback method and no validation is performed. private void doRequest() { Callback callback = getCallback(); DeviceAssure.check("DEVICEASSURE-CLOUD-API-LICENCE", callback); }- Parameters:
licence- Licence key required to perform the validation. Must be a valid licence key.callback- The callback class that the library will use to inform the host application when the operation has been successful or an error occurred.- Since:
- Android Version 14
-
getData
public static void getData(Callback customerCallback)
[Server to Server] Run device validation for apps that support Android API >= 14. The check method is called from a host application in order to start the device verification process. During validation the library will collect some data about the device and return the measured properties back to the callback. This method does not include any API call to the DeviceAssure Cloud API, this must be implemented manually. It is important to note, that the headers in the check request eventually sent to the DeviceAssure API must include the user-agent of the device in question. Any and all headers must be prefixed with 'DV-'. For more information, please consult the README or Implementation Guide. private void doRequest() { Callback callback = getCallback(); DeviceAssure.getData(callback); }- Parameters:
customerCallback- The callback class that the library will use to inform the host application when the operation has been successful or an error occurred.- Since:
- Android Version 14
-
check
public static void check(Callback callback, java.net.URL[] urls)
[OnSite] Run device validation, only for apps that support Android API < 14. This method should be used with an OnSite API service. It doest not require the licence key to be added to the requests to work for onSite hosted implementations. The check method is called from a host application in order to start the device verification process. During validation the library will collect some data about the device and send to the specified servers to process. Should an error occur during the sending and processing that library will attempt to retry the validation a number of times. After all the retries have been exhausted and not successful response returned the library will sent a
'Failed to connect'message back via the handleError callback method. In the case where the device has no internet connectivity, a'No Internet Connection'message will be returned via the handleError callback method and no validation is performed. private void doRequest() { URL[] urls = URL[3]; urls[0] = new URL("https://server1.com"); urls[1] = new URL("https://server2.com"); urls[2] = new URL("https://server3.com"); Callback callback = getCallback(); DeviceAssure.check(callback, urls); }- Parameters:
callback- The callback class that the library will use to inform the host application when the operation has been successful or an error occurred.urls- Overriding urls to send request to.- Since:
- Android Version 14
-
check
public static void check(Callback callback, java.lang.String[] urls)
[OnSite] Run device validation, only for apps that support Android API < 14. This method should be used with an OnSite API server. It doest not require the licence key to be added to the requests to work for OnSite hosted implementations. The check method is called from a host application in order to start the device verification process. During validation the library will collect some data about the device and send to the specified servers to process. Should an error occur during the sending and processing that library will attempt to retry the validation a number of times. After all the retries have been exhausted and not successful response returned the library will sent a
'Failed to connect'message back via the handleError callback method. In the case where the device has no internet connectivity, a'No Internet Connection'message will be returned via the handleError callback method and no validation is performed. private void doRequest() { String[] urls = String[3]; urls[0] = "https://server1.com"; urls[1] = "https://server2.com"; urls[2] = "https://server3.com"; Callback callback = getCallback(); DeviceAssure.check(callback, urls); }- Parameters:
callback- The callback class that the library will use to inform the host application when the operation has been successful or an error occurred.urls- Overriding urls to send request to.- Since:
- Android Version 14
-
-