notification

This commit is contained in:
Peter Maquiran
2022-01-26 17:28:55 +01:00
parent 58a32f45d4
commit 66098ae4e8
5 changed files with 87 additions and 15 deletions
@@ -0,0 +1,45 @@
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
import { CapacitorConfig } from '@capacitor/cli';
import { LocalNotifications } from '@capacitor/local-notifications';
@Injectable({
providedIn: 'root'
})
export class NativeNotificationService {
constructor(private platform: Platform,) {
this.askForPermission()
}
askForPermission() {
LocalNotifications.requestPermissions()
}
sendNotificationChat({title = 'User', icon = '', message = 'hello'}) {
LocalNotifications.schedule({
notifications:[
{
title : 'tile',
body : 'df',
id : 55
}
]
});
}
isDesktop() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
return true
} else {
return false
}
}
}