Please ignore the comments I edited my previous questions as I want to start bounty on it
I have an angular project for kindy portal which is where teacher post kids/students post of what they are doing during the day and when a new article is published for a child I want to send a push notification to that specific parent on ios device.
Currently some previous employee used some 3rd party stuff or some technology to create the website to application (from what I know they just wrote a line of code to reference the same code for website to the app) so people will think its an application but its loading stuff from the web. And I don’t have details of it or where the code is for it so I am trying to figure out if its possible to do without the need of APN so i can continue working on it or if its not possible to do without APN then I can’t as I don’t have access to that source code of how they made it to app.
So my question is: if I want to use firebase to send the notification on ios device to specific user is firebase enough or smart enough to do it by its own or do I need APN to be able to get the user token from their ios device and use that to send the notification?
3
Answers
To send push notifications to iOS devices using Firebase Cloud Messaging (FCM), you will need to use the Apple Push Notification Service (APNs) in conjunction with Firebase. FCM acts as a middleman between your server and various push notification services, including APNs for iOS devices. Here’s how the process works:
Certainly! Here’s a step-by-step example of how to send a push notification to a specific iOS device using Firebase Cloud Messaging (FCM) and APNs in an Angular project:
1. Set up Firebase Project:
2. Add Firebase to your Angular project:
Install the Firebase JavaScript SDK:
Initialize Firebase in your Angular project. You typically do this in your
app.module.ts
:3. Obtain Device Token:
In your Angular app, when a user logs in or installs the app, you need to obtain the device token and send it to your server.
You can use the Firebase JavaScript SDK to obtain the device token. Here’s an example:
4. Send a Notification:
On your server (typically using a backend server like Node.js), when you want to send a notification to a specific user, you would send a request to FCM with the user’s device token.
Here’s a simplified example of how you might send a notification using the
firebase-admin
Node.js SDK:In this example, replace
'USER_DEVICE_TOKEN'
with the actual device token of the target user. The server sends a request to FCM, which then relays the notification to the target device via APNs.This is a simplified example, and you may need to implement additional features like managing multiple tokens for a user or handling message payloads according to your requirements.
As a way for Apple to regulate push notifications only Apple can send it. So yeah you MUST have APNS.
Reasons for that are: