@sarahmurraydesign wrote:
Hi Guys currently trying to implement a location based local Notification - that when a user enters a locations radius - they are notified - probably easy I know… But Im new enough and Im not exactly sure how to declare the trigger
I’ve been referencinghttps://github.com/katzer/cordova-plugin-local-notifications#location-based,
Heres my code:app.t
export class AppComponent:
notificationSent = false;
trackLat;
trackLng;
lat;
lng;
x = 53.5017237;
y = - 6.460589116;
radius = 500;
trigger;
initializeApp
this.backgroundMode.on(‘activate’).subscribe(() => {
console.log(‘activated’);const location = this.geolocation.watchPosition(); location.subscribe((location) => {
this.trackLat = location.coords.latitude;
this.trackLng = location.coords.longitude;
if (location === this.trigger(‘location’)) {
this.locationNotification();
}});
locationNotification() {
this.localNotification.schedule({
id: 2,
title: ‘Welcome to the show grounds!’,
text: ‘Click me to declare your entries!!’,
sound: ‘’,
trigger: {
type: ‘location’,
center: [this.x, this.y],
radius: this.radius,
notifyOnEntry: true,
notifyOnExit: false,
single: true
},
vibrate: true,
foreground: true
});
}I know I’m not calling the trigger of the notification correctly - If anyone can help me out it would be amazing!
Posts: 2
Participants: 1