Update device information
Requirements
- Registered Device
- Authenticated Device (Not required if the device is not yet registered)
- Associated Profiles
- iOS (Swift)
- Android (Java)
var localDevice = try trustfactorClient.getCurrentDevice()
localDevice.setPushNotifications(token: <String?>, provider: <TFPushNotificationsProvider>?) // empty token or provider will disable push notifications delivery
try localDevice.setName(<String>) // throws if device name does not fulfill the requirements
localDevice.setLocale(<Locale>)
trustfactorClient.updateDevice(localDevice, { result, correlationID in
switch result {
case .success(_):
// no value is returned
case .failure(let error):
// handle error
}
})
TFDevice localDevice = trustfactorClient.getCurrentDevice();
String pushNotificationsToken = "<>";
TFPushNotificationsProvider provider = TFPushNotificationsProvider.FIREBASE;
localDevice.setPushNotificationsToken(pushNotificationsToken, provider);
try {
localDevice.setName("YourDeviceName"); // throws if device name does not fulfill the requirements
} catch (Exception e) {
// handle exception
}
Locale locale = Locale.getDefault();
localDevice.setLocale(<Locale>)
trustfactorClient.updateDevice(localDevice: <TFDevice>, new Result<Boolean, Error>() {
@Override
public void onSuccess(Boolean value, String correlationId) {
// value is a boolean we can ignore
}
@Override
public void onFailure(Error error, String correlationId) {
// handle error
}
});