question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ios] Notifications.getDevicePushTokenAsync() does not resolve in bare workflow

See original GitHub issue

Looks related to #8084 which should have fixed this bug

"expo-notifications": "0.3.2",
"expo-permissions": "8.1.0",
"react-native-unimodules": "0.9.1",

Pods:

pod install
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Detected React Native module pods for RNCAsyncStorage, RNCMaskedView, RNDateTimePicker, RNDeviceInfo, RNFBAnalytics, RNFBApp, RNFBInAppMessaging, RNFBPerf, RNGestureHandler, RNReanimated, RNSVG, RNScreens, RNSentry, react-native-safe-area-context, and rn-fetch-blob
Installing unimodules:
 expo-application@2.2.1 from ../node_modules/expo-application/ios
 expo-av@8.1.0 from ../node_modules/expo-av/ios
 expo-constants@9.1.1 from ../node_modules/expo-constants/ios
 expo-file-system@8.1.0 from ../node_modules/expo-file-system/ios
 expo-font@7.0.0 from ../node_modules/expo-font/ios
 expo-image-loader@1.0.1 from ../node_modules/expo-image-loader/ios
 expo-in-app-purchases@8.1.0 from ../node_modules/expo-in-app-purchases/ios
 expo-keep-awake@8.1.0 from ../node_modules/expo-keep-awake/ios
 expo-linear-gradient@7.0.0 from ../node_modules/expo-linear-gradient/ios
 expo-localization@8.1.0 from ../node_modules/expo-localization/ios
 expo-notifications@0.3.2 from ../node_modules/expo-notifications/ios
 expo-permissions@8.1.0 from ../node_modules/expo-permissions/ios
 expo-web-browser@8.2.0 from ../node_modules/expo-web-browser/ios
 unimodules-app-loader@1.0.2 from ../node_modules/unimodules-app-loader/ios
 unimodules-barcode-scanner-interface@5.1.0 from ../node_modules/unimodules-barcode-scanner-interface/ios
 unimodules-camera-interface@5.1.0 from ../node_modules/unimodules-camera-interface/ios
 unimodules-constants-interface@5.1.0 from ../node_modules/unimodules-constants-interface/ios
 unimodules-core@5.1.2 from ../node_modules/@unimodules/core/ios
 unimodules-face-detector-interface@5.1.0 from ../node_modules/unimodules-face-detector-interface/ios
 unimodules-file-system-interface@5.1.0 from ../node_modules/unimodules-file-system-interface/ios
 unimodules-font-interface@5.1.0 from ../node_modules/unimodules-font-interface/ios
 unimodules-image-loader-interface@5.1.0 from ../node_modules/unimodules-image-loader-interface/ios
 unimodules-permissions-interface@5.1.0 from ../node_modules/unimodules-permissions-interface/ios
 unimodules-react-native-adapter@5.2.0 from ../node_modules/@unimodules/react-native-adapter/ios
 unimodules-sensors-interface@5.1.0 from ../node_modules/unimodules-sensors-interface/ios
 unimodules-task-manager-interface@5.1.0 from ../node_modules/unimodules-task-manager-interface/ios
Found some duplicated unimodule packages. Installed the ones with the highest version number.
Make sure following dependencies of your project are resolving to one specific version:
 expo-constants
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 71 dependencies from the Podfile and 94 total pods installed.

Example code:

try {
  const settings = await Notifications.getPermissionsAsync()
  console.log('SETTINGS', settings)
  console.log('REQUEST TOKEN')
  const {data: token} = await Notifications.getDevicePushTokenAsync() // << STUCK
  console.log('TOKEN TOKEN', token)
} catch (err) {
  console.log('ERROR', err)
}

Output:

[Wed Jun 10 2020 14:19:14.570]  LOG      SETTINGS {"canAskAgain": true, "expires": "never", "granted": true, "ios": {"alertStyle": 1, "allowsAlert": true, "allowsBadge": true, "allowsCriticalAlerts": null, "allowsDisplayInCarPlay": null, "allowsDisplayInNotificationCenter": true, "allowsDisplayOnLockScreen": true, "allowsPreviews": 1, "allowsSound": true, "providesAppNotificationSettings": false, "status": 2}, "status": "granted"}
[Wed Jun 10 2020 14:19:14.572]  LOG      REQUEST TOKEN
  • Wifi is up and running
  • Permission is already granted
  • No error is thrown

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
sjchmielacommented, Oct 22, 2020

I’ll let myself close this issue tentatively, hopefully believing my previous answer cleared all the misconceptions. If not, please feel free to reopen this issue or open a new one. 🙂

1reaction
martinezguillaumecommented, Jun 12, 2020

Same problem here !

EDIT: Thanks to this comment, I just rebooted my phone and boom, it worked…

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native - getDevicePushTokenAsync error on bare workflow
I implemented push notification on managed workflow which is working properly but when I eject from managed workflow, I am getting error at ......
Read more >
Push Notifications Troubleshooting & FAQ
No, you can use any push notification service for both managed and bare workflow apps. The getDevicePushTokenAsync method from expo-notifications allows you ...
Read more >
expo-notifications-bux-fix v0.12.0 - npm.io
expo-notifications. Provides an API to fetch push notification tokens and to present, schedule, receive and respond to notifications.
Read more >
npm:@elemental-design/expo-notifications - Skypack.dev
This library is not yet usable within managed projects — it is likely to be ... getDevicePushTokenAsync -- resolves with a device push...
Read more >
React Native & Expo SDK Setup - OneSignal Documentation
Use an Expo Bare Workflow. Follow Expo's guide on Ejecting from the Managed Workflow. ... iOS versions under 10 will not be able...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found