Page 1 sur 1

#Android utiliser les notifications

Publié : sam. 29/mai/2021 12:17
par killer128
Bonjour,
Aujourd'hui je vous présente une solution pour crée des notifications via votre app.
Le code fonctionne.

Code : Tout sélectionner

;https://github.com/katzer/cordova-plugin-local-notifications
;Import Cordova Plugin
Import "cordova plugin add cordova-plugin-local-notification"
EndImport

;No debug
;CloseDebugOutput()
Debug "bijour"

! document.addEventListener('deviceready', function () {
Debug "ready"
! cordova.plugins.notification.local.requestPermission(function (granted) { });
Debug "ini notif ok"
! cordova.plugins.notification.local.hasPermission(function (granted) { });
 Debug "perm ok , send notif"   
v.s ="bob"
  !v_v= cordova.plugins.notification.local.launchDetails ;
! cordova.plugins.notification.local.schedule({
!    title: 'Nouvelle sortie',
!    text: 'n oublie pas la sortie prochaine\n qui arrive.',
;!    icon: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTzfXKe6Yfjr6rCtR6cMPJB8CqMAYWECDtDqH-eMnerHHuXv9egrw',
;    attachments: ['file://img/rb-leipzig.jpg'],
!    foreground: true
! });
!}, false);

Re: #Android utiliser les notifications

Publié : ven. 04/juin/2021 8:58
par falsam
Merci pour ce code que je testerais ce week-end avec le code qui permet de faire tourner une application en background.

Re: #Android utiliser les notifications

Publié : mer. 24/mai/2023 12:03
par hitman72
hi, I'm trying it with SpiderBasic 2.40 (I'm a newbie about android app and SpiderBasic) but when I compile and create the apk I have the followinf error:

Image

Reading around, maybe the problem is cordova version (?), one solution is to change the import line using git (installed in a windows pc)

Import "cordova plugin add http://github.com/katzer/cordova-plugin ... :EndImport

I can able to make the apk but in the phones (tested on android 7 and android 12) nothing happens, dubug stucks in "Ready", like if the line
! cordova.plugins.notification.local.requestPermission(function (granted) { });
stucks the apk

How fix it with SpiderBasic 2.40, or, how can I get a simple notification on Android? thank you

Re: #Android utiliser les notifications

Publié : lun. 05/juin/2023 23:09
par Ar-S
Thank you for making the effort to write in French on the French forum. You can use deepl to do so.
---------------------
Merci de faire l'effort d'écrire en Français sur le forum fançais. Vous pouvez utiliser deepl pour le faire.