Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Onesignal Register Device issue

$
0
0

@Trivedi wrote:

I have an Onesignal Push code which was working in ionic 2 but not working in ionic4 now. Here is the code.

import { OneSignal } from ‘@ionic-native/onesignal/ngx’;

this.onesignal.startInit(‘SOME_ID’, ‘SOME_ID’);
this.onesignal.inFocusDisplaying(this.onesignal.OSInFocusDisplayOption.None);

        this.onesignal.getIds().then((data) => {
          this.DeviceToken = data.userId;
        });
        this.onesignal.endInit();

        let push = Push.init({
              android: {
                  senderID: "MY_SENDER_ID"
              },
              ios: {
                  alert: true,
                  badge: false,
                  gcmSandbox: true,
                  sound: true,
                  senderID: "MY_SENDER_ID"
              },
              windows: {}
          });
          push.on('registration', (data) => {
              console.log("device token ->", data.registrationId);
              this.DeviceToken = data.registrationId;
          });

It shows me the error with Push.init (Error TS2552: Canont find name ‘Push’. Did you mean ‘push’?)

Can anybody please help me what changed in ionic 4?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



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