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

Ionic Local Notification click

$
0
0

@perenyitamas wrote:

Hello!

My problem is that i am trying to show an alert when the user click the notification. I tried it on my device, but nothing happens when i click to the notification, just fade away. No console error.


 constructor(public alertCtrl: AlertController,private plt: Platform, public navCtrl: NavController, public navParams: NavParams,private vibration: Vibration,private storage: Storage,private localNotifications: LocalNotifications) {
    this.plt.ready().then((rdy)=>{
      this.localNotifications.on('click',(notification, state)=>{
        let json=JSON.parse(notification.data);
        let alert=this.alertCtrl.create({
          title: notification.title,
          subTitle: json.mydata
        });
        alert.present();
      });
      });
  }
sendNotification(){
    this.localNotifications.schedule({
      id: 1,
      title: 'Lejárt az idő!',
      text: 'Érdemes lenne újra dobni! :)',

      //sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
      data: { mydata:'teszt' }
    });
  }

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70439

Trending Articles



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