Please provide the following:
- SDK Version: sdk 44
- Platforms(Android/iOS/web/all): Android
- Add the appropriate “Tag” based on what Expo library you have a question on.
Hi,
I need help with expo notifications in ejected app on Android.
I’m not getting the token on Android on iOS there is no problem.
I use this code to get token:
this.registerForPushNotificationsAsync().then( (token) => {
tokenMy = token;
console.log("tokenMy __", tokenMy);
});
and function is here:
async registerForPushNotificationsAsync() {
let token;
const { status: existingStatus } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== 'granted') {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== 'granted') {
alert('Failed to get push token for push notification!');
return;
}
token = (await Notifications.getExpoPushTokenAsync()).data;
console.log( "token", token);
if (Platform.OS === 'android') {
Notifications.setNotificationChannelAsync('default', {
name: 'Viz&eArt',
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: '#5B6F96',
});
}
return token;
}
I get this error:
Error: Fetching the token failed: FIS_AUTH_ERROR
promiseMethodWrapper@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:3333:45
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:110337:42
getDevicePushTokenAsync$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:414657:83
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28272:32
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28174:30
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28204:19
tryCallTwo@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:32962:9
doResolve@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33126:25
Promise@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:32985:14
callInvokeWithMethodAndArg@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28203:33
enqueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28208:157
async@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28223:69
getDevicePushTokenAsync@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:414629:38
getExpoPushTokenAsync$@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:414757:84
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28272:32
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28174:30
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28204:19
tryCallTwo@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:32962:9
doResolve@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33126:25
Promise@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:32985:14
callInvokeWithMethodAndArg@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28203:33
enqueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28208:157
async@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28223:69
getExpoPushTokenAsync@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:414744:38
registerForPushNotificationsAsync$
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28272:32
tryCatch@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28102:23
invoke@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28174:30
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:28184:21
tryCallOne@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:32953:16
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33054:27
_callTimer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33382:17
_callImmediatesPass@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33421:17
callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:33638:33
__callImmediates@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:3842:35
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:3621:34
__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:3825:15
flushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.my.app&modulesOnly=false&runModule=true:3620:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]
What I did:
- Added Android app in Firebase console with my package name
- Downloaded google-services.json and put it in android/app folder
- Downloaded my Server key to Expo.
4 Checked that it was downloaded with expo credentials:manager.
- Builded and downloaded the app to Closed testing on Google.
5 Regenerated the Keystore file because nothing was working.
6 Added permission ` to AndroidManifest.xml
Read all related topics several times.
I need help with this problem. Thank you.