spes:node_acs
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| spes:node_acs [2014/09/24 08:43] – creata letti | spes:node_acs [2014/10/28 11:28] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | **Risultato atteso:** inviare notifiche | + | =====GUIDA PER LE PUSH===== |
| - | **Teconologie: | ||
| - | **Referenze:** | + | ===Risultato atteso:=== |
| - | Node.ACS quickstart: http://docs.appcelerator.com/ | + | Inviare notifiche PUSH da un server verso altri device registrati al servizio. È richiesto che la notifica arrivi anche se il ricevente non è UP. |
| - | Node.ACS MVC Framework: http:// | + | |
| - | Node.ACS CLI command reference: http:// | + | |
| - | Google Developing Console (API Key): https:// | + | |
| - | **Installazione** | + | ===Teconologie: |
| - | In questa sezione vengono registrati i passi svolti seguendo il QuickStart di Node.ACS ( http:// | + | Appcelerator |
| - | - installare **Node.js** e **npm** | + | ===Referenze: |
| - | * installare Node.js dal sito http:// | ||
| - | * npm è installato automaticamente con Node dalla versione 0.6.3 . Nel caso fosse necesario installarlo, | + | |
| + | * http://www.titaniumtutorial.com/2013/10/acs-push-notification-using-gcm.html | ||
| + | * http:// | ||
| - | - installare la Node.ACS CLI, **acs** | + | ====Settare l' |
| - | * npm install -g acs | + | E’ necessario installare cURL: [http:// |
| - | **Creare una app | ||
| - | - Login | + | > NOTA: in questo documento viene mostrato come inviare notifiche ad un device Android. Tuttavia il processo è parallelo per device IOS, con i dovuti accorgimenti riportati nei link alla documentazione di Appcelerator presenti nelle prossime sezioni. |
| - | Autenticazione all' | ||
| - | acs login | + | ====Azioni preventive==== |
| - | **richiede un account Appcelerator** | ||
| - | - Creare applicazione: | + | ===Configurare il servizio di push per Android=== |
| - | acs new nome_app | ||
| - | Di default, l' | + | * Questa parte è volta all’utilizzo di GCM (Google Cloud Messaging) |
| + | * Creare un progetto nella Google Cloud Console [https:// | ||
| + | * l’ID del progetto (nellla schermata di riepilogo dello stesso) | ||
| + | * una API KEY, ottenuata creando una Server Key nella sezione “APIs & Auth” | ||
| + | * Creare un’ACS app nell’ Appcelerator cloud console [https:// | ||
| - | - Pubblicare la app nel cloud: | ||
| - | cd nome_app | + | ===Configurare il servizio di push per IOS=== |
| - | acs publish | + | |
| + | * Questa parte è volta all’utilizzo di APN (Apple Push Notifications ] per implementare un servizio di Push Notifications verso device IOs utilizzando ACS. | ||
| + | * Non testato, ma c’è una guida esaustiva su: [http:// | ||
| + | |||
| + | ====INVIARE PUSH NOTIFICATIONS==== | ||
| + | |||
| + | In [http:// | ||
| + | |||
| + | > **Importante: | ||
| + | |||
| + | > **NOTA:** controllare se l’autenticazione è effettivamente fatta tramite i cookie, e non sia a livello di sessione | ||
| + | |||
| + | |||
| + | Il device deve essere precedentemente registrato. | ||
| + | |||
| + | > **NOTA:** a meno di controlli, è possibile per un utente registrarsi diverse volte con lo stesso utente ma diversi devices | ||
| + | |||
| + | |||
| + | ===SINTASSI=== | ||
| + | |||
| + | curl -b cookies.txt -c cookies.txt [ [-F “param=value”] ] https:// | ||
| + | |||
| + | |||
| + | ===AUTENTICAZIONE: | ||
| + | |||
| + | ==req== | ||
| + | |||
| + | curl -b cookies.txt -c cookies.txt -F" | ||
| + | |||
| + | ==resp== | ||
| + | |||
| + | < | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | ] | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==Parametri: | ||
| + | |||
| + | “login=” richiede il nome utente | ||
| + | “password=” richiede la password | ||
| + | “key=” richiede l’APP KEY della ACS APP sul cloud appcelerator | ||
| + | |||
| + | |||
| + | ===PUSH:=== | ||
| + | |||
| + | ==req: | ||
| + | curl -b cookies.txt -c cookies.txt -F " | ||
| + | |||
| + | ==resp:== | ||
| + | |||
| + | < | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | }, | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==parametri: | ||
| + | |||
| + | “channel=” è il canale su cui viene pushata la notifica | ||
| + | “to_ids=” contiene una lista di id relativi ai device iscritti al canale | ||
| + | “payload=” contiene il testo della notifica | ||
| + | “key=” richiede l’APP KEY della ACS APP sul cloud appcelerator | ||
| + | |||
| + | > **NOTA:** altre proprietà possono essere settate, come i Badges. Inoltre ci sono alcune proprietà settabili solo per device Android. | ||
| + | |||
| + | > **NOTA:** il parametro payload puo essere settato in due diversi modi, come stringa o come Json: | ||
| + | |||
| + | > payload : String/Hash required | ||
| + | > Payload to send with the push notification. | ||
| + | > For a string, it will be sent as an alert (message notification). | ||
| + | > For a JSON payload, you can specify the following fields as well as custom fields: | ||
| + | > alert (String): Notification message to be displayed. | ||
| + | > badge (String): Number to set as the badge on the application' | ||
| + | > sound (String): Filename minus the extension of the sound to play. | ||
| + | > For native Android applications, | ||
| + | > For native iOS applications, | ||
| + | > For Android applications built with Titanium, place the file in the / | ||
| + | > For iOS applications built with Titanium, place the file in the /Resources directory. | ||
| + | > icon (String): Available on Android only. Filename minus the extension of the icon to display in the notification center. Place the file in / | ||
| + | > title (String): Available on Android only. Title of the notification. | ||
| + | > vibrate (Boolean): Available on Android only. If true, the device vibrates for one second. | ||
| + | > For example: | ||
| + | > { | ||
| + | > " | ||
| + | > " | ||
| + | > " | ||
| + | > " | ||
| + | > ], | ||
| + | > " | ||
| + | > " | ||
| + | > " | ||
| + | > } | ||
| + | > In the above example, the atras and tags keys are custom fields, " | ||
| + | |||
| + | |||
| + | > **DA VERIFICARE: | ||
| + | |||
| + | |||
| + | ====PER DEPLOYARE UN’APPLICAZIONE CHE POSSA REGISTRARSI SULL’ACS==== | ||
| + | |||
| + | E’ necessario Titanium CLI. | ||
| + | |||
| + | ===Prerequisiti: | ||
| + | |||
| + | Installare le oracle JDK (da 6 a 8 ) | ||
| + | Installare Node.js | ||
| + | Installare Android SDK (per la versione, vedere http:// | ||
| + | Installare Android NDK > 9 (per la vesrione non rischiesto) http:// | ||
| + | |||
| + | ===Installare la CLI con il comando npm=== | ||
| + | |||
| + | npm install -g titanium | ||
| + | |||
| + | ===Fare il login tramite npm=== | ||
| + | |||
| + | titanium login | ||
| + | |||
| + | ===Installare le SDK=== | ||
| + | |||
| + | titanium sdk install | ||
| + | |||
| + | ===Configurare=== | ||
| + | |||
| + | titanium setup quick , oppure | ||
| + | titanium setup (avanzato) | ||
| + | |||
| + | |||
| + | ===SVILUPPO SU DEVICE=== | ||
| + | |||
| + | I device Android riceventi devono usare il pacchetto ti.cloudpush per registrarsi all’ACS sotto una applicazione ACS. In seguito ricevereanno le push notifications inviate loro sui canali corrispondenti. | ||
| + | |||
| + | I device IOS riceventi devono usare il pacchetto ti.cloud per registrarsi all’ACS sotto una applicazione ACS. In seguito ricevereanno le push notifications inviate loro sui canali corrispondenti. | ||
spes/node_acs.1411548198.txt.gz · Last modified: 2014/10/28 11:28 (external edit)
