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

Error on getting PlayerId from OneSignal service

$
0
0

@Catweazle101 wrote:

Hi

I try to implement the PushNotification feature in my app using the OneSignal service.
Everything works at the moment, but now I’m trying to get the PlayerId from the OneSignal service but
I get an error in the try catch.
But the error says nothing :-((

This is my code:

        var notificationOpenedCallback = function (jsonData) {
          console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
        };

        window["plugins"].OneSignal
          .startInit("2f288ebf-95ba-4f06-9348-fe6a63035ccb", "119423241284")
          .handleNotificationOpened(notificationOpenedCallback)
          .endInit();

          window["plugins"].OneSignal.getIds().then((id) => {
            alert('playerid: ' + id);
          });

Attention
I only get an error if I add/use the getIds() method:

         window["plugins"].OneSignal.getIds().then((id) => {
            alert('playerid: ' + id);
          });

What do I wrong?
Is getIds() not the right method?
I didn’t find any method, which gives me the playerId, even on the Api-Reference

All tips are welcome :slight_smile:

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49247

Trending Articles



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