updateFcmToken
Function Introduction
Note
Updates the Firebase user token on the IM server.
Warning
(1) This interface is used to set or refresh the Firebase user token. An expiration time can be specified, and it is only effective when the server's offline push is set to Firebase.
- iOS
- Android
- Flutter
- Browser/Electron/MiniProgram
- uni-app
- React-Native
Function Prototype
Future updateFcmToken({
required String fcmToken,
required int expireTime,
String? operationID,
});
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
fcmToken | String | Yes | FCM Token |
expireTime | int | Yes | FCM Token expiration time, in seconds |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
then | void | Success callback |
onError | Function | Failure callback |
Code Example
OpenIM.iMManager.updateFcmToken(fcmToken: '', expireTime: );
Function Prototype
- (void)updateFcmToken:(NSString *)fcmToken
expireTime:(NSInteger )expireTime
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
fcmToken | NSString | Yes | FCM Token |
expireTime | int | Yes | FCM Token expiration time, in seconds |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Success return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager updateFcmToken:@""
expireTime:
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Parameter Details
Parameter Name | Description |
---|---|
fcmToken | FCM Token |
expireTime | FCM Token expiration time, in seconds |
Code Example
OIMManager.getInstance().updateFcmToken(fcmToken, expireTime, new OIMSuccessCallback() {
@Override
public void onSuccess(String data) {
// handle success
}
}, new OIMFailureCallback() {
@Override
public void onFailure(int code, String msg) {
// handle failure
}
});
Parameter Details
Parameter Name | Description |
---|---|
fcmToken | FCM Token |
expireTime | FCM Token expiration time, in seconds |
Code Example
updateFcmToken(fcmToken, expireTime)
.then(data => {
// handle success
})
.catch(err => {
// handle failure
});
Function Prototype
function updateFcmToken(fcmToken, expireTime) {
// implementation
}
Input Parameters
Parameter Name | Description |
---|---|
fcmToken | FCM Token |
expireTime | FCM Token expiration time, in seconds |
Code Example
updateFcmToken(fcmToken, expireTime)
.then(data => {
// handle success
})
.catch(err => {
// handle failure
});
Function Prototype
function updateFcmToken(fcmToken, expireTime) {
// implementation
}
Input Parameters
Parameter Name | Description |
---|---|
fcmToken | FCM Token |
expireTime | FCM Token expiration time, in seconds |
Code Example
updateFcmToken(fcmToken, expireTime)
.then(data => {
// handle success
})
.catch(err => {
// handle failure
});