Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Last active July 14, 2017 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/88a21462ea1a6b46f2824450207d11d1 to your computer and use it in GitHub Desktop.
Save matthieu-D/88a21462ea1a6b46f2824450207d11d1 to your computer and use it in GitHub Desktop.
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