Last active
July 14, 2017 22:02
-
-
Save matthieu-D/88a21462ea1a6b46f2824450207d11d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { LocalNotifications } from '@ionic-native/local-notifications'; | |
. | |
. | |
. | |
export class HomePage { | |
notificationAlreadyReceived = false; | |
constructor( | |
public backgroundMode: BackgroundMode, | |
public platform: Platform, | |
public localNotifications: LocalNotifications) { | |
platform.ready().then(() => { | |
this.backgroundMode.on('activate').subscribe(() => { | |
console.log('activated'); | |
if(this.notificationAlreadyReceived === false) { | |
this.showNotification(); | |
} | |
}); | |
this.backgroundMode.enable(); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment