Skip to content

getExpoPushTokenAsync hangs on Android device (Expo Client) #7673

@bonafidehan

Description

@bonafidehan

🐛 Bug Report

Environment

Expo CLI 3.17.15 environment info:
System:
OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.14.1 - ~/node/node-v12.14.1-linux-x64/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.14.4 - ~/node/node-v12.14.1-linux-x64/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
expo: ^36.0.0 => 36.0.1
react: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4
react-navigation: ^4.3.2 => 4.3.2
npmGlobalPackages:
expo-cli: 3.17.15

Target: Android on Expo Client

Steps to Reproduce

On Android device, using Expo client, request a token using the reproducible code below.

Expected Behavior

Token to be returned from getExpoPushTokenAsync

Actual Behavior

  • Execute below code on Android device, on Expo client (not standalone)
  • Prints 'Getting token', then app hangs on getExpoPushTokenAsync, doesn't print 'Got token'
  • No errors printed and finally clause is not executed

Reproducible Demo

    import { Notifications } from 'expo'
    import * as Permissions from 'expo-permissions'
    import Constants from 'expo-constants';

    try {
      const p = await Permissions.getAsync(Permissions.NOTIFICATIONS)
      if (Constants.isDevice) {
        if (p.status === 'granted') {
          console.log('Getting token')
          const tok = await Notifications.getExpoPushTokenAsync()
          console.log('Got token')
        }
      }
    } catch (err) {
      console.log(err)
    } finally {
      console.log('Finally')
    }

Notifications enabled:
Screenshot_20200405-161001

Metadata

Metadata

Assignees

Labels

AndroidExpo GoThe client distributed on app stores

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions