It is currently 22 April 2025, 13:10 Advanced search

Gestione Notifiche

Domande e risposte su come utilizzare Instant Developer Cloud al meglio

Gestione Notifiche

Postby mcdok » 7 March 2019, 8:08

Salve, sto provando a inviare delle notifiche push verso Android/iOS, un po' prendendo spunto dalla demo plug-in, un po' ricordando quanto fatto in Foundation ho scritto un po' di codice:

Sulla app mobile installata su InstaLauncher (non nello store):

yield app.device.notification.hasPermission() ritorna True

var registerOptions = {resubscribe : true} ;
$token.innerText = yield app.device.notification.register(null, registerOptions);

ritorna il token nella forma: gcm-eS9Bjw4A-KQ:APA91...H8VuvuyJ2

Sulla app server:

yield app.device.notification.hasPermission() ritorna True

var notificationObj = {title : "Instant push notification", body : "Hello from Instant Developer Cloud", payload : "XXX123", badge : 1} ;
var res = yield app.device.notification.push(notificationObj, token);
console.log(res);
console.log(res.results[0]);

ritorna:
> {multicast_id: 5615843859414692000, success: 1, failure: 0, canonical_ids: 0, results: Array[1]}
> {message_id: "0:1551945637569072%a799c730f9fd7ecd"}


Sul dispositivo Android non arriva nulla.

Dove sbaglio? Cosa manca? Che differenze ci sono per iOS?
mcdok
 
Posts: 855
Joined: 19 July 2011, 16:18

Return to Tips & Tricks - Cloud

Who is online

Users browsing this forum: No registered users and 8 guests

cron