Check device information and status
You can use the deviceGet method to get the information that the SDK has recorded regarding the device.
You must instantiate a DeviceCallback object and pass it as the second parameter of the deviceGet method. This callback will receive as a parameter the device object that contains all the information associated with the device.
Indigitall.deviceGet(context, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail(ErrorModel errorModel) {}
});Indigitall.deviceGet(context, object : DeviceCallback(context) {
override fun onSuccess(device: Device?) {
Log.d("Device", device.toString())
}
override fun onFail(errorModel: ErrorModel?) {
// Handle the error
}
})Enable/disable device
You can choose to disable the device to block the receipt of notifications. It is a very useful method to:
- Implement a preferences screen so that the user can enable / disable the receipt of notifications.
- Avoid receiving notifications if the user has not logged in, or has not accepted the terms of use, etc.
- Manage the Robinson List .
To do this, you have the deviceEnable and deviceDisable methods.
You must instantiate a Device Callback object and pass it as the second parameter. This callback will receive as a parameter the_device object that contains all the information associated with the device.
Indigitall.deviceEnable(context, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail(ErrorModel errorModel) {}
});
Indigitall.deviceDisable(context, new DeviceCallback(context) {
@Override
public void onSuccess(Device device) {
Log.d("Device: ", device.toString());
}
@Override
public void onFail(ErrorModel errorModel) {}
});val callback = object : DeviceCallback(context) {
override fun onSuccess(device: Device?) {
Log.d("Device", device.toString())
}
override fun onFail(errorModel: ErrorModel?) {
// Handle the error
}
}
Indigitall.deviceEnable(context, callback)
Indigitall.deviceDisable(context, callback)