0

I have a client-server service. The client runs on apache cordova and the server is java based. I need to add push notifications to it and I thought about using aerogear. I read the tutorials and successfully sent a push notification from the cordova app.

I want to be able to send a push notification to just one of the clients. Can this be done using aerogear?

Thanks.

barisdad
  • 515
  • 7
  • 19

2 Answers2

1

Currently the only way to do it would be to add some "criteria" to the message you are sending that targets a specific installation.

So during the registration of your device with the Unified Push Server, you can add an alias to the push config, the device token would probably be best:

var pushConfig = { pushServerURL: "<pushServerURL e.g http(s)//host:port/context >", alias: "<alias e.g. a username or an email address optional>", android: { ... }, ios: { ... } };

Then when you send your message, you can add that "alias" as a "criteria".

edit: i've created this JIRA, https://issues.jboss.org/browse/AGPUSH-1117 , to track this

lholmquist
  • 143
  • 7
0

For newer versions of Aerogear (curl script example):

curl -u "{PushApplicationID}:{MasterSecret}" -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "criteria": { "variants" : ["c3f0a94f-48de-4b77-a08e-68114460857e", "444939cd-ae63-4ce1-96a4-de74b77e3737" ....], "alias" : ["user@account.com", "someone@aerogear.org", ....], "categories" : ["someCategory", "otherCategory"], "deviceType" : ["iPad", "AndroidTablet"] }, "message": { "alert":"HELLO!", "sound":"default", "badge":7, "content-available" : true, "action-category" : "some_category", "simple-push": "version=123", "user-data": { "someKey":"some value", "anotherCustomKey":"some other value" }, "windows": {
"type": "tile",
"duration": "short",
"badge": "alert",
"tileType": "TileWideBlockAndText01",
"images": ["Assets/test.jpg", "Assets/background.png"], "textFields": ["foreground text"]
},
}, "config": { "ttl" : 3600, } }'

https://SERVER:PORT/CONTEXT/rest/sender

J D
  • 274
  • 3
  • 17