Issue
I am facing a problem, when I am running an app through expo client app, PushNotifications works. But if I am building a standalone .apk, I need to install expo client, in order to get pushtoken. And, when expo client is not turned on, I cannot get pushtoken. So my customer needs to install 2 apps. One is mine, built standalone .apk, and other is expo client. It is tedious flow..
Solution
I was able to fix expo push notifications in my project. It was my own fault. The problem was this, even documentation provides solution: So I created an account with Firebase, then I attached new project. Then I ran this command:
expo push:android:upload --api-key <Server key>
You can get server key from this section:
It will look something like this:
XXXSdasx665:APA91bFL2342342342342342342342RxDAUbCOP0IL32etVueLhnLtoFErsqHBhjW-SRPSZGdU18BBIltUx7Wm234234234sxdxzcasdSElRyTEdMR7vmLJHgVvbOGx-0-SWDasdzxzxzx
This helped me to fix the issue I was having. Hopes it will help someone too.
This is an app.json file:
{
"expo": {
"name": "workero",
"slug": "workero",
"privacy": "public",
"sdkVersion": "36.0.0",
"platforms": ["android"],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"package": "com.workero.apper",
"googleServicesFile": "./google-services.json"
}
}
}
Answered By - LuckyLuke
Answer Checked By - Timothy Miller (JavaFixing Admin)