Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Post Timeline

deleted 123 characters in body
Source Link
Robert
  • 9.1k
  • 61
  • 194
  • 215

I am working on an Ionic (Angular + Cordova) app and using the @ionic-native/local-notifications plugin to schedule reminder notifications.

On iOS, interval notifications do not show at all when the device is locked.

On Android, interval notifications work for the first 2–3 times, but after that they stop showing when the device is locked.

What I have done?

Verified I've verified notification permissions are granted.

WorksIt works sometimes when the app is foregrounded, but not reliably in the background or on the lock screen.

Environment: Ionic Angular Cordova

Code snippet: import { LocalNotifications, ELocalNotificationTriggerUnit } from '@ionic-native/local-notifications/ngx';

@Injectable()

export class NotificationService {

constructor(private localNotifications: LocalNotifications) {}

// Call this method to send a repeating notification

sendIntervalNotification() {

import { LocalNotifications, ELocalNotificationTriggerUnit } from '@ionic-native/local-notifications/ngx';
@Injectable()
export class NotificationService {
 constructor(private localNotifications: LocalNotifications) {}
 // Call this method to send a repeating notification
 sendIntervalNotification() {
 this.localNotifications.schedule({
 id: 1,
 title: 'Reminder',
 text: 'This is your scheduled notification',
 trigger: {
 every: { minute: 1 }, // runs every 1 minute
 count: 10 // total number of times to repeat
 },
 foreground: true, // show when app is foregrounded
 lockscreen: true // try to display on lockscreen
});
 }
}

}

}

Question:

How can I make recurring/interval local notifications work consistently on both iOS and Android, even when the app is in the background or the device is locked?

I am working on an Ionic (Angular + Cordova) app and using the @ionic-native/local-notifications plugin to schedule reminder notifications.

On iOS, interval notifications do not show at all when the device is locked.

On Android, interval notifications work for the first 2–3 times, but after that they stop showing when the device is locked.

What I have done?

Verified notification permissions are granted.

Works sometimes when the app is foregrounded, but not reliably in the background or on the lock screen.

Environment: Ionic Angular Cordova

Code snippet: import { LocalNotifications, ELocalNotificationTriggerUnit } from '@ionic-native/local-notifications/ngx';

@Injectable()

export class NotificationService {

constructor(private localNotifications: LocalNotifications) {}

// Call this method to send a repeating notification

sendIntervalNotification() {

this.localNotifications.schedule({
 id: 1,
 title: 'Reminder',
 text: 'This is your scheduled notification',
 trigger: {
 every: { minute: 1 }, // runs every 1 minute
 count: 10 // total number of times to repeat
 },
 foreground: true, // show when app is foregrounded
 lockscreen: true // try to display on lockscreen
});

}

}

Question:

How can I make recurring/interval local notifications work consistently on both iOS and Android, even when the app is in the background or the device is locked?

I am working on an Ionic (Angular + Cordova) app and using the @ionic-native/local-notifications plugin to schedule reminder notifications.

On iOS, interval notifications do not show at all when the device is locked.

On Android, interval notifications work for the first 2–3 times, but after that they stop showing when the device is locked.

I've verified notification permissions are granted.

It works sometimes when the app is foregrounded, but not reliably in the background or on the lock screen.

import { LocalNotifications, ELocalNotificationTriggerUnit } from '@ionic-native/local-notifications/ngx';
@Injectable()
export class NotificationService {
 constructor(private localNotifications: LocalNotifications) {}
 // Call this method to send a repeating notification
 sendIntervalNotification() {
 this.localNotifications.schedule({
 id: 1,
 title: 'Reminder',
 text: 'This is your scheduled notification',
 trigger: {
 every: { minute: 1 }, // runs every 1 minute
 count: 10 // total number of times to repeat
 },
 foreground: true, // show when app is foregrounded
 lockscreen: true // try to display on lockscreen
});
 }
}

How can I make recurring/interval local notifications work consistently on both iOS and Android, even when the app is in the background or the device is locked?

Source Link

Ionic Local Notifications not working consistently on lock screen (iOS & Android)

I am working on an Ionic (Angular + Cordova) app and using the @ionic-native/local-notifications plugin to schedule reminder notifications.

On iOS, interval notifications do not show at all when the device is locked.

On Android, interval notifications work for the first 2–3 times, but after that they stop showing when the device is locked.

What I have done?

Verified notification permissions are granted.

Works sometimes when the app is foregrounded, but not reliably in the background or on the lock screen.

Environment: Ionic Angular Cordova

Code snippet: import { LocalNotifications, ELocalNotificationTriggerUnit } from '@ionic-native/local-notifications/ngx';

@Injectable()

export class NotificationService {

constructor(private localNotifications: LocalNotifications) {}

// Call this method to send a repeating notification

sendIntervalNotification() {

this.localNotifications.schedule({
 id: 1,
 title: 'Reminder',
 text: 'This is your scheduled notification',
 trigger: {
 every: { minute: 1 }, // runs every 1 minute
 count: 10 // total number of times to repeat
 },
 foreground: true, // show when app is foregrounded
 lockscreen: true // try to display on lockscreen
});

}

}

Question:

How can I make recurring/interval local notifications work consistently on both iOS and Android, even when the app is in the background or the device is locked?

lang-js

AltStyle によって変換されたページ (->オリジナル) /