[@nativescript/local-notifications] Scheduling a notification using the "at" property results in the notification being severly late
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 28/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- android, javascript, typescript
- Domaine
- mobile-dev
Piste de recherche
Commencez par reproduire le délai sur Android 13 avec l’exemple de planification JavaScript/TypeScript fourni, en utilisant @nativescript/core 8.5.7 et @nativescript/local-notifications 6.1.1. Comparez l’heure at demandée avec l’heure de livraison réelle sur les appareils signalés ; le travail est considéré comme terminé lorsque le délai de planification a été identifié et corrigé, et que le comportement a été vérifié pour des intervalles courts et plus longs.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
- Android 13, targeting API level 33
- @nativescript/core 8.5.7
- @nativescript/local-notifications 6.1.1
This has not been tested on iOS yet, but will be soon, and I'll update this issue with the results once that has been done. It has been replicated on both a Samsung phone and tablet.
While trying to make use of the LocalNotifications.schedule() functionality, the notification arrives as expected, but ends up being significantly late. For instance, when trying to schedule a notification a minute into the future:
public async addScheduledNotification(notificationId: string) {
const notification = NOTIFICATION_TYPES.find((n => n.id == notificationId));
const targetStart = new Date(new Date().getTime() + 60 * 1000);
console.log(`target start: ${targetStart}`);
console.log(`getTime: ${targetStart.getTime()}`);
console.log(await LocalNotifications.schedule([{
id: Number.parseInt(notification.id),
title: 'My App',
body: notification.body,
// interval: 'day' as ScheduleInterval,
channel: 'MyApp',
priority: 2,
at: targetStart
}]));
console.log(await LocalNotifications.getScheduledIds());
}
Output:
JS: CONSOLE LOG: target start: Tue Sep 05 2023 21:30:00 GMT-0400 (EDT)
JS: CONSOLE LOG: getTime: 1693963800000
JS: CONSOLE LOG: [0]
JS: CONSOLE LOG: [0]
the notification will arrive about 1 minute and forty five seconds from the time the code runs. I've tried different use cases and the delay can be as large as 15 minutes to an hour. Lowering the delay to ten seconds after the code runs results in it arriving on time. Leaving the at parameter out results in the notification being shown immediately as expected. There doesn't seem to be much of a difference whether the screen is on or off when the notification is supposed to fire. Seeing as the screen is often on and there's still a delay, I don't suspect the issue is due to a battery saver or Doze.
From my reading of the Android documentation and this plugin's source code, exact alarms are being used with RTC_WAKEUP so there shouldn't be much of a delay in the showing of the notification.
- Langage dominant
- TypeScript
- Étoiles
- 206
- Forks
- 123
- Merge moyen
- 2 j 1 h
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NativeScript/plugins
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
NativeScript/plugins#680 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
NativeScript/plugins#671 ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
NativeScript/plugins#640 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
NativeScript/plugins#668 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
NativeScript/plugins#665 · 1 commentaire ·
Toutes les issues de NativeScript/plugins
Issues similaires
-
Type/Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
OpenNSW/nsw-srilanka#497 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
0xMiden/bridge-portal#132 ·
-
react-doctor severity:warning tech-debt
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
digidem/comapeo-cloud-app#403 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100