“expo-notifications” does not work on the standalone android app !?

The weirdest thing and the lack of precise documentation, using “expo-notifications” on SDK 38 and SDK 40 is a pain.

The weird piece is, the getexpoPushTokenAsync() method works on the Expo Go app but does not return anything in the standalone android app. Well, in case if you are using async await and waiting for the token to be returned, the app gets stuck due to this method and worsens the situation. Also it's hard as well to debug the exact reason for the failure.

Going through multiple threads, I have managed to find the solution for this.

Following are the steps to make it work:
1) Sign In to your firebase account https://console.firebase.google.com/

2) Create a project.

3) Once you land on your dashboard, click on Add app button and create a android app.

4) Be careful while creating the app, make sure you use the same app name and the exact same bundle identifier that you have used in your app.json file.

5) While creating the app, download the google-services.json returned by the firebase console.

6) Add this downloaded google-services.json file to your topmost hierarchy of the workspace and also, register it in your app.json file.

Note: Please refer to the below screenshot to get a clean view of this.

7) Moreover, refer to the “apiKey” from your google-services.json file and register the same in your app.json file(refer to above screenshot).

8) Push the secret key to the expo server by executing the following command:

expo push:android:upload — api-key <SECRET-KEY>

Note: Get the server key from the firebase console. Project Settings >> Cloud Messaging >> Token is your secret key.

.…and you are done.

Build the app, and you can see the getexpoPushTokenAsync() method returns you a token.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store