Creating and scheduling Local Notifications in ionic 2

In almost every mobile app there is Notification comes which contain short message or anything. In this tutorial we are creating and scheduling Local Notification using ionic 2.

Before We start make sure your ionic is updated with ionic 2. If not then update ionic with following command

Let’s start with creating fresh new ionic 2 project

Got to project folder

Adding platform

Note that if you have to make ios app then you required mac

After that install Local Notifications plugin

Go to Home.ts file and paste below code

In this file we have imported LocalNotifications from ionic-native that is cordova plugin and imported AlertController for displaying popup contain textbox and button.

Here we have created two function which is normalnotification() and schedulenotification(). First function is for creating normal notification and second one for scheduling the notification.

Next open Home.html file and paste below code

Here we have created two buttons first one is for Normal Notification and second is for Schedule Notification

1 Comment

  1. Not at all working..
    Cannot find module ‘ionic-native’
    I tried
    import { LocalNotifications } from ‘@ionic-native/local-notifications’;
    but not working in ionic 2

Leave a Reply to Sharanagouda Cancel reply