Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49167

Send PUSH to all users using API

$
0
0

@Dyrk wrote:

I see in the control panel possibility to send push notification to all users. Is it possible to do the same using API? I tried already to send a request with empty tokens array "tokens": [] however, no notifications were delivered.

If it's not yet possible to do through the API, can you suggest me the best practice how to store these tokens on backend side in DB? I see that app generates token each time on startup, and I don't have and don't want to have registration. So, basically, if user will kill and re-open app 100 times I will save 100 different tokens for his device.
How can I understand that some tokens are already outdated and should be removed from DB?

So far I used the standard code to register device in ionic platform:

    var push = new Ionic.Push({
      "debug": true,
      "pluginConfig": {
        "ios": {
          badge: "false",
          sound: "true"
        }
      },
      "onNotification": function(notification) {
        var payload = notification.payload;
        console.log(notification, payload);
      },
      "onError": function(err) {
        console.log(JSON.stringify(err));
      }
    });

    push.register(function(token) {
      console.log("Device token:",token.token);
      push.saveToken(token);  // persist the token in the Ionic Platform
    });

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>