Device
Models and methods for managing the current device's registration and metadata.
TFDevice
Represents the current device and its associated metadata.
- iOS (Swift)
- Android (Java)
public struct TFDevice {
public let id: String
public private(set) var name: String
public private(set) var locale: Locale?
public private(set) var pushNotificationsToken: String?
public private(set) var pushNotificationsProvider: TFPushNotificationsProvider?
public private(set) var registrationDate: Date?
public init(
id: String,
name: String,
locale: Locale? = nil,
pushNotificationsToken: String? = nil,
pushNotificationsProvider: TFPushNotificationsProvider? = nil,
registrationDate: Date? = nil
)
/// Updates the device name.
/// Throws if the name does not satisfy the length requirements.
public mutating func setName(_ name: String) throws
/// Updates the push notification token and provider.
public mutating func setPushNotifications(
token: String?,
provider: TFPushNotificationsProvider?
)
/// Updates the device locale.
public mutating func setLocale(_ locale: Locale)
}
public class TFDevice {
public final String id;
public TFDevice(
String id,
String name,
Locale locale,
String pushNotificationsToken,
TFPushNotificationsProvider pushNotificationsProvider,
Date registrationDate
)
public String getId()
public String getName()
/** Updates the device name. Throws if the name does not satisfy the length requirements. */
public void setName(String name) throws Error
public Locale getLocale()
public void setLocale(Locale locale)
public String getPushNotificationsToken()
public TFPushNotificationsProvider getPushNotificationsProvider()
public Date getRegistrationDate()
/** Updates the push notification token and provider. */
public void setPushNotificationsToken(String token, TFPushNotificationsProvider provider)
}
TFPushNotificationsProvider
The push notification service used by the device.
- iOS (Swift)
- Android (Java)
public enum TFPushNotificationsProvider: String {
case apple
case firebase
}
public enum TFPushNotificationsProvider {
NO_PROVIDER,
FIREBASE,
HUAWEI
}