MCPcopy Create free account
hub / github.com/NativeScript/firebase / getToken

Method getToken

packages/firebase-messaging/index.ios.ts:49–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 }
48
49 getToken(): Promise<string> {
50 return new Promise((resolve, reject) => {
51 if (!TNSFirebaseCore.isSimulator() && !UIApplication.sharedApplication.registeredForRemoteNotifications) {
52 reject(new Error('You must be registered for remote messages before calling getToken, see messaging().registerDeviceForRemoteMessages()'));
53 return;
54 }
55 this.native?.tokenWithCompletion((token, error) => {
56 if (error) {
57 reject(FirebaseError.fromNative(error));
58 } else {
59 resolve(token);
60 }
61 });
62 });
63 }
64
65 getAPNSToken() {
66 const token = this.native.APNSToken;

Callers

nothing calls this directly

Calls 1

fromNativeMethod · 0.45

Tested by

no test coverage detected