Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding firebase support. #23

Merged
merged 7 commits into from
Mar 23, 2023
Merged

Adding firebase support. #23

merged 7 commits into from
Mar 23, 2023

Conversation

sormys
Copy link
Member

@sormys sormys commented Mar 21, 2023

If you want to send test message to android device you need token of the device. Then add environmental variable
import { getMessaging } from 'firebase-admin/messaging
and then under

console.log([server]: Server is running at localhost:${port})

paste code below:

const registrationToken = 'YOUR_REGISTRATION_TOKEN' 
const message = {
  data: {
    score: '850',
    time: '2:45'
  },
  token: registrationToken
}

getMessaging().send(message)
  .then((response) => {
    console.log('Successfully sent message:', response)
  })
  .catch((error) => {
    console.log('Error sending message:', error)
  })

(replace YOUR_REGISTRATION_TOKEN with the token of the device) Now after starting the server a message should be sent to the device.

@codecov
Copy link

codecov bot commented Mar 21, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (e32bf0f) 0.00% compared to head (a40a334) 0.00%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main     #23   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          1       1           
  Lines          6       8    +2     
=====================================
- Misses         6       8    +2     
Impacted Files Coverage Δ
src/index.ts 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Kwasow Kwasow merged commit fa7d715 into main Mar 23, 2023
@Kwasow Kwasow deleted the @sormys/addingFirebaseCM branch March 23, 2023 14:08
@sormys sormys linked an issue Mar 23, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup Firebase Cloud Messaging
3 participants