Commit 234faf45 authored by Libin Lu's avatar Libin Lu Committed by GitHub

Merge pull request #836 from ditkachuk/fix-get-entity-fcm

 Fix getEntityFCMToken resolve and update README
parents 739816ea ec7a4f36
......@@ -455,6 +455,22 @@ class App extends Component {
.catch(error => {
//Error while deleting instance id
});
// Use this functions instead of FCM.getFCMToken if you want revokes access of token
FCM.getEntityFCMToken()
.then(token => {
// Returns a token that authorizes an FCM Entity by Instance ID
// Store fcm token in your server
})
FCM.deleteEntityFCMToken()
.then( () => {
// Deleted token successfully
// Revokes access to a scope (action) for an entity previously authorized by getToken() with Instance ID
// This will reset token
})
.catch(error => {
// Error while deleting token
});
}
}
```
......
......@@ -408,6 +408,7 @@ RCT_EXPORT_METHOD(getEntityFCMToken:(RCTPromiseResolveBlock)resolve rejecter:(RC
if (deviceToken == nil) {
resolve(nil);
return;
}
[[FIRInstanceID instanceID]tokenWithAuthorizedEntity:entity scope:kFIRInstanceIDScopeFirebaseMessaging options:@{@"apns_token": deviceToken} handler:^(NSString * _Nullable token, NSError * _Nullable error) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment