Draft
Conversation
Following the instructions from here https://docs.expo.io/versions/latest/guides/push-notifications/?redirected we should be able to generate a push token and display it in an alert dialog. Then we can test sending push notifications by using the expo P.N. tool: https://expo.io/dashboard/notifications
doub1ejack
commented
Dec 9, 2019
Member
Author
doub1ejack
left a comment
There was a problem hiding this comment.
Just some contextual comments.
| pushToken: token, | ||
| updated: firebase.firestore.FieldValue.serverTimestamp() | ||
| }); | ||
| } |
Member
Author
There was a problem hiding this comment.
I don't think this branch uses this function yet.
| const PUSH_ENDPOINT = 'https://your-server.com/users/push-token'; | ||
|
|
||
| export default async function registerForPushNotificationsAsync() { | ||
| const { status: existingStatus } = await Permissions.getAsync( |
Member
Author
There was a problem hiding this comment.
I don't know if there's a better place to keep P.N. related stuff. Using the libs dir might make sense if there isn't a more intuitive place.
|
|
||
|
|
||
| // POST the token to your backend server from where you can retrieve it to send push notifications. | ||
| // return fetch(PUSH_ENDPOINT, { |
Member
Author
There was a problem hiding this comment.
Obviously we would want to send the token to the server using redux and the appropriate actions.
| > | ||
| <TouchableHighlight | ||
| onPress={() => this.ellipsisLogoutAlert()} | ||
| onPress={() => this.pushTokenAlert()} |
Member
Author
There was a problem hiding this comment.
This is how I triggered the push token generation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an experiment in generating the push notification token and saving it to firebase.
Note: this work is not properly tied into RN/Redux. I skipped past redux by hijacking the logout ellipsis and setting an on-click even that would display the token. I wanted to take a real token and play with the expo push notification so I made this work-around. Unfortunately, I haven't gotten to the point where I was able to do anything interesting with it yet.