Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Push notification Expo推送通知生成重复令牌_Push Notification_Expo_React Native Push Notification - Fatal编程技术网

Push notification Expo推送通知生成重复令牌

Push notification Expo推送通知生成重复令牌,push-notification,expo,react-native-push-notification,Push Notification,Expo,React Native Push Notification,SDK版本:37 平台(Android/iOS/web/all):全部 每次运行waitNotifications.getExpoPushTokenAsync()生成相同的令牌。该令牌看起来像:ExponentPushToken[NgTr99YO5fy0EQM4R]。我能够得到这个令牌的推送通知,所以我知道它的格式是正确的,我只是不明白为什么它在应该生成一个新的令牌时一直推送相同的令牌给我。我错过了什么 const registerForPushNotificationsAsync = asyn

SDK版本:37 平台(Android/iOS/web/all):全部

每次运行wait
Notifications.getExpoPushTokenAsync()生成相同的令牌。该令牌看起来像:ExponentPushToken[NgTr99YO5fy0EQM4R]。我能够得到这个令牌的推送通知,所以我知道它的格式是正确的,我只是不明白为什么它在应该生成一个新的令牌时一直推送相同的令牌给我。我错过了什么

const registerForPushNotificationsAsync = async () => {
  if (Constants.isDevice) {
    const {status: existingStatus} = await Permissions.getAsync(
      Permissions.NOTIFICATIONS
    );
    let finalStatus = existingStatus;
    if (existingStatus !== "granted") {
      const {status} = await Permissions.askAsync(Permissions.NOTIFICATIONS);
      finalStatus = status;
    }
    if (finalStatus !== "granted") {
      return;
    }
    token = await Notifications.getExpoPushTokenAsync();
  } else {
    alert("Must use physical device for Push Notifications");
  }

  if (Platform.OS === "android") {
    Notifications.createChannelAndroidAsync("default", {
      name: "default",
      sound: true,
      priority: "max",
      vibrate: [0, 250, 250, 250],
    });
  }
  return token;
};
遵循以下文档:
我的错误。复制令牌是根据我用来创建新令牌的设备创建的。在我的例子中,我在同一台设备上制作了多个配置文件,因此我收到的每个配置文件的令牌都是相同的,这让我很失望

一切都在按部就班地进行着