Notification push / One signal


I try to make notifications for my application, I managed to set up notifications with OneSignal! it allows me to send notifications to ALL users.

However, I try to make sure to sent, for example a notification to a particular person when she received a comment …

Someone know how to do it? I did some testing but nothing came up …

Thank you

1 Like

I give up with onesignal, i recommend firebase and this plugin:

so much easy to target specefic users

1 Like

Thanks for reply, i will try with that, can you give me an exemple of how its works ?

First you need to create a project in firebase

For android it will genetare a file call google_services.json that you need to put in the root folder of your project.

then you need to initialize firebase in your project following the official docs

I use the official library for angular2

Then FCMPlugin has different functions to retrieve tokens for users, later use for target that users, that you can save where you want, and functions for upcoming notifications.

Finally you build and send a notification like this:

let headers = new Headers({ 'Authorization': 'key=YOUR_API_KEY', 'Content-Type': 'application/json' });
          let options = new RequestOptions({ headers: headers });
          let notification = {
            "notification": {
              "title": NOTIFICATION_TITLE,
              "body": NOTIFICATION_BODY,
              "click_action": "FCM_PLUGIN_ACTIVITY",
              "sound": "default"
            }, "data": {
              //OPTIONAL PARAMS
            "to": USER_TOKEN,
            "priority": "high"
          let url = '';
, notification, options)

Hope this will help you, i am not the best explaining things

1 Like

Hmm … Is this work when the application is not open ?

Sure It works. :slight_smile:

1 Like

I can not do it … I try to do the steps but it does not work … I can not finalize my application without notifications … I use the command to install FCM, after I connected my application android a firebase and I put a method … I’m not even what it serves I do not understand the system of notifications … It’s so difficult?

I follow this tutoriel : but not working for me …

if you want to send to someone specifically you need to send data with include_player_ids: [player_id_array] you can take a look at this link

1 Like

Thank you for your answer, I already saw this documentation but I can not apply it … I have no concrete example

take a look at the docs and you can search in the net for other examples… there are so many examples of it…

1 Like

I tried, all that I put in place, the problem is to send a notification from the application, for example when a person puts a comment to another person it sends him a notification

yeah you can achieve it with one signal you just need to study and make the installation of OneSignal correct…

I already done that :
app.component.ts :
(in constructor)

app.module.ts :


anything in the OneSignal dashboard? list of users(player_id)??

Yeah in the method i use the player id ! Now i need too implement a new method who send a notifications, so i open a page i call the method on a click (for test) and i put the code from the documentation in node JS and that’s not work …

any console.log errors?

I cant use the console, i can’t use the ionic serve because of the method in the app.component.ts

I just run into my devices for try

you can see the console.log using chrome://inspect (connect your device to the computer)