deleteInstanceId feature (Android only)

This commit is contained in:
Michele Bombardi 2017-09-26 16:33:20 +02:00
parent b53bf5bbe8
commit e6cb5fed60
3 changed files with 23 additions and 0 deletions

View File

@ -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
View File

@ -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.

View File

@ -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