Push notifications in builds
See original GitHub issuePush notifications in production builds
Hey. I have an issue with push notification in the production builds of an app. I have tested many things including to switch from my own build server to expos server but that didn’t help either. With the expo app it gets the token, but with a production build it just does nothing.
Used code to get the token
pushKeyGet = async () => {
const { status: existingStatus } = await Permissions.askAsync(Permissions.NOTIFICATIONS)
let finalStatus = existingStatus
if (finalStatus !== 'granted') {
return Alert.alert("Fehler", "Ohne die Zustimmung können wir Ihnen keine Nachrichten schicken.");
}
let token = await Notifications.getExpoPushTokenAsync()
await this.storeData(token, "@ep/notif/token")
fetch(config.apiserver + "/addPushKey", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: token
})
}).then(result => result.json()).then(async res => {
if (res.request.status != "SUCCESS") {
await this.removeData("@ep/notif")
await this.removeData("@ep/notif/token")
return Alert.alert("Fehler", "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.")
}
}).catch(async e => {
await this.removeData("@ep/notif")
await this.removeData("@ep/notif/token")
return Alert.alert("Fehler", "Ein unbekannter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.")
})
}
Repo
The source code of the app is private but I can give you access to the part of the app, that makes problems.
Testing
I only tested the build on Android.
Building
I am building with turtle-cli but using the normal expo-cli to build didn’t change anything.
Many thanks in advance Fabian
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
The Ultimate Guide To Push Notifications For Developers
Messages should be timely, relevant, and precise. · Use emojis, they tend to help CTR. · Make sure your content is valuable. ·...
Read more >What You Must Know To Build Savvy Push Notifications
A great push notification is three things: timely, personal and actionable. Evolution of Push Notifications. Before sharing tactics, Weiss summarizes the ...
Read more >Push Notifications: Why You Want Them & How to Build Them ...
Common Strategies for Push Notifications · Start by leveraging your existing audience and find ways to incentivize them to opt-in for your push ......
Read more >Codelab: Build a push notification server - web.dev
A step-by-step interactive tutorial that shows you how to build a server that manages push notification subscriptions and sends web push ...
Read more >Standard Push Notifications Tutorial - BuildFire University
Learn how to use our Push Notification system which allows you to send notifications to all users, notification groups, and custom segments.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @AdamJNavarro, I made set the token through the command and it worked. Thank you so much for your help and your time.
Have a nice day and safe Fabian
Or do I have to upload like this?
Thank you Fabian