如何将 FCM 令牌转换为 APNS 令牌? [英] How to convert a FCM token to APNS token?

查看:26
本文介绍了如何将 FCM 令牌转换为 APNS 令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们考虑从 Firebase Cloud Messaging 迁移来构建我们自己的推送引擎.我们需要迁移转换 FCM 令牌的用户以获取原始 APNS 令牌.那怎么办呢?

We consider migrating from Firebase Cloud Messaging to build our own push engine. We need to migrate the users converting FCM tokens to get the raw APNS token. How can that be done?

我只能找到将 APNS 转换为 FCM 令牌的程序.https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens

I can only find a procedure to convert APNS to FCM tokens. https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens

有什么方法可以解码 FCM 令牌?

Any way to decode the FCM tokens?

推荐答案

您可以通过以下方式从 react-native-firebase 获取令牌.

You can get the token from react-native-firebase with the following way.

  firebase
    .messaging()
    .ios.registerForRemoteNotifications()
    .then(() => {
      console.log('REGISTER FOR REMOTE NOTIFICATIONS');

      firebase
        .messaging()
        .ios.getAPNSToken()
        .then(token => {
          console.log(
            'APNS TOKEN AFTER REGISTRATION FOR BACKGROUND',
            token,
          );
        });
    });

这篇关于如何将 FCM 令牌转换为 APNS 令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆