AWARE Push iOS is a Node.js based small service for communicating between AWAREFramework-iOS from a server-side through Apple Push Notification services (APNs).
-
Setup Node.js Setup Node.js packages
npm install
-
Getting a certification for push notification
-
Edit configurations for Node.js Please rename
config/sample.json
toconfig/default.json
, and fill out the configurations for connecting AWARE and APN-server. -
Run aware-push-ios
node app.js
- Test
Normal Push Notification
curl -X POST -H "Content-Type: application/json" -d '{"alert":{"title":"TITLE","body":"BODY"},"tokens":["TOKEN"],"id":"YOUR_ID","key":"YOUR_KEY"}' http://127.0.0.1:3000/alert
Silent Push Notification
curl -X POST -H "Content-Type: application/json" -d '{"payload":{"aware":{"v":1,"ops":[{"cmd":"start-all-sensors"}]}},"tokens":["TOKEN"],"id":"YOUR_ID","key":"YOUR_KEY"}' http://127.0.0.1:3000/silent
Continuation Silent Push Notification
curl -X POST -H "Content-Type: application/json" -d '{"token":"TOKEN","device_id":"DEVICE_ID","platform":1}' http://127.0.0.1:3000/token/register
curl -X POST -H "Content-Type: application/json" -d '{"token":"TOKEN","device_id":"DEVICE_ID","platform":1}' http://127.0.0.1:3000/token/unregister
platform (0=Unknown, 1=iOS, 2=Android)
{
"alert":{
"title":"TITLE",
"body":"BODY"
},
"tokens":[
"TOKEN"
],
"id":"HOGE_ID",
"key":"HOGE_KEY"
}
{
"payload":{
"aware":{
"v":1,
"ops":[
{"cmd":"reactivate-core"}
]
}
},
"tokens":["TOKEN"],
"id":"HOGE_ID",
"key":"HOGE_KEY"
}
You can insert the following commands if you need.
- {"cmd":"start-all-sensors"}
- {"cmd":"stop-all-sensors"}
- {"cmd":"sync-all-sensors"}
- {"cmd":"sync-sensor","targets":["accelerometer"]}
- {"cmd":"reactivate-core"}
- {"cmd":"push-msg","msg":{"title":"","body":""}}