mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-06-19 10:08:58 +08:00
deleteInstanceId feature (Android only)
This commit is contained in:
@@ -72,6 +72,17 @@ public class RNFirebaseMessaging extends ReactContextBaseJavaModule implements L
|
||||
promise.resolve(FirebaseInstanceId.getInstance().getToken());
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deleteInstanceId(Promise promise){
|
||||
try {
|
||||
FirebaseInstanceId.getInstance().deleteInstanceId();
|
||||
promise.resolve(null);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
promise.reject(null, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void createLocalNotification(ReadableMap details) {
|
||||
Bundle bundle = Arguments.toBundle(details);
|
||||
|
||||
4
index.d.ts
vendored
4
index.d.ts
vendored
@@ -608,6 +608,10 @@ declare module "react-native-firebase" {
|
||||
* This token can be used in the Firebase console to send messages to directly.
|
||||
*/
|
||||
getToken(forceRefresh?: Boolean): Promise<string>
|
||||
/**
|
||||
* Reset Instance ID and revokes all tokens.
|
||||
*/
|
||||
deleteInstanceId(): Promise<any>
|
||||
/**
|
||||
* On the event a devices FCM token is refreshed by Google,
|
||||
* the new token is returned in a callback listener.
|
||||
|
||||
@@ -109,6 +109,14 @@ export default class Messaging extends ModuleBase {
|
||||
return this._native.getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Instance ID and revokes all tokens.
|
||||
* @returns {*|Promise.<*>}
|
||||
*/
|
||||
deleteInstanceId() {
|
||||
return this._native.deleteInstanceId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and display a local notification
|
||||
* @param notification
|
||||
|
||||
Reference in New Issue
Block a user