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

OneSignal: handleNotificationOpened not getting triggered when cold start

$
0
0

@patwaswapnil wrote:

It works when app is running in background and i click on received notification but not working when coldstart from received notification.
.

  shared.LS.get('user').then((data: any) => {
      if (!data) {
        this.rootPage = AuthPage;
      } else {
        this.globalProvider.setAuthData(data);
        this.rootPage = TabsPage;
      }
    });
    platform.ready().then(() => {

      if (platform.is('cordova')) {

        this.oneSignal.startInit('**********', '*****************');

        this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);

        this.oneSignal.handleNotificationReceived().subscribe((data) => {
          console.log(data);
        });
        this.oneSignal.handleNotificationOpened().subscribe((data) => {
          console.log(data);
          let type
          try {
              type = data.notification.payload.additionalData.type;
          } catch (e) {
            console.warn(e);
          }
          switch (type) {
            case 'Followers': {
              this.navController.push(UserProfilePage, {userId: data.notification.payload.additionalData.uid})
            break;
            }
          }
        });
        this.oneSignal.endInit();
      }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



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