Push Notifiaction

Push Notifications

Goto: https://firebase.google.com

Step 1 :Create a Firebase App

First, you should create a free Firebase account and create a new project there. You can visit firebase.google.com and signup if you don't have an account with Google earlier, and if you have an account, you can create a firebase app project. You can enter the project Name and Select Region, and it will create a Firebase project for you.

Once the project gets Created, Navigate into Overview menu on the left side there you can see project overview and under that click on project settings there you have to click on cloud messaging you will get server key and sender ID as displayed in the below screenshot

Step 2 :

Goto https://onesignal.com/. Create account or log in if you are already a registered user. Then click on 'Add New App' on the screen window. Enter app name and organisation name and click on add app as shown in the screenshot below

It will navigate to the page and asks you to select the platform ,select the platform (google android ) click on next

there you find the fields to enter Firebase server key and firebase server ID here you need to paste the server key and ID that you got from Step 1 and click on save as displayed in the screenshot below.

Step 3 :

In onesignal.com after creating the project click on the project then settings >Key and ID's copy this one signal APP ID and rest API key shown in the screenshot given below

Step 4 :Replace Server key and sender ID in your Project folder

Navigate to the project folder there on the left-hand side go to src>routes>restaurant >push notification>push-notification.component.ts

There you can replace the app Id and then below that navigate to the folder push-notification.service.ts you can paste the rest API key that you received.

The above steps is to send push notifications for all the users .

Last updated