#Android utiliser les notifications

Rubriques generale concernant SpiderBasic
killer128
Messages : 28
Inscription : mer. 30/mai/2012 15:15

#Android utiliser les notifications

Message 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);
Avatar de l’utilisateur
falsam
Messages : 7244
Inscription : dim. 22/août/2010 15:24
Localisation : IDF (Yvelines)
Contact :

Re: #Android utiliser les notifications

Message par falsam »

Merci pour ce code que je testerais ce week-end avec le code qui permet de faire tourner une application en background.
Configuration : Windows 11 Famille 64-bit - PB 6.03 x64 - AMD Ryzen 7 - 16 GO RAM
Vidéo NVIDIA GeForce GTX 1650 Ti - Résolution 1920x1080 - Mise à l'échelle 125%
hitman72
Messages : 1
Inscription : mer. 24/mai/2023 11:52

Re: #Android utiliser les notifications

Message 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
Avatar de l’utilisateur
Ar-S
Messages : 9476
Inscription : dim. 09/oct./2005 16:51
Contact :

Re: #Android utiliser les notifications

Message 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.
~~~~Règles du forum ~~~~
⋅.˳˳.⋅ॱ˙˙ॱ⋅.˳Ar-S ˳.⋅ॱ˙˙ॱ⋅.˳˳.⋅
W11x64 PB 6.x
Section HORS SUJET : ICI
LDV MULTIMEDIA : Dépannage informatique & mes Logiciels PB
UPLOAD D'IMAGES : Uploader des images de vos logiciels
Répondre