Yes, I tried it. It's easy.
Do you know, for me, what's one of the biggest - unexpected - hurdle to
surpass? The information you people give about the URLs to use, etc.; it
varies according to the platform ("context" for using your terminology).
For instance, someone that is on Cordova / mobile , must use something
different from another guy targeting etwas anderes... And for a newbie
arriving from outside to your ecosystem it's not so easy as you might think.
Thanks for your support.
M
On Mon, Feb 24, 2014 at 6:21 PM, Matthias Wessendorf <matzew(a)apache.org>wrote:
On Mon, Feb 24, 2014 at 7:14 PM, Matthias Wessendorf <matzew(a)apache.org>wrote:
>
>
>
> On Mon, Feb 24, 2014 at 6:36 PM, Miguel Lemos <miguel21op(a)gmail.com>wrote:
>
>> That would be neat if I understand a simple way to send a push to a
>> particular dude's phone. So far I've not yet understood how...
>>
>
>
> use an alias that is *unique* (E.g. the user-id in your backend):
>
> curl -3 -u "{variantID}:{secret}"
> -v -H "Accept: application/json" -H "Content-type:
application/json"
> -X POST
> -d '{
> "deviceToken" : "someTokenString",
> "alias" : "myUniqueString"
> }'
>
>
https://SERVER:PORT/context/rest/registry/device
>
> Now, the above does store this string (the alias ) on the device
> metadata.
>
Oh, since you are using Cordova, I translated the generic curl (from our
REST API doc) to JavaScript:
var pushConfig = {
// senderID is only used in the Android/GCM case
senderID: "<senderID e.g Google Project ID only for android>",
pushServerURL: "<pushServerURL e.g http(s)//host:port/context >",
variantID: "<variantID e.g. 1234456-234320>",
variantSecret: "<variantSecret e.g. 1234456-234320>",
alias: "myUniqueString" // NOTE!! this must be unique to the user. Do not
hard-code that string ;)
// Recommendation is: username;
// the user logins to your backend system. After a successful login you should know
the username, which can than
// be used when the 'JavaScript' for the device registration is being
executed;
}
//badge and sound are iOS specific, and ignored on Android
push.register(successHandler, errorHandler, {"badge": "true",
"sound": "true",
"ecb": "onNotification", pushConfig: pushConfig});
--
Matthias Wessendorf
blog:
http://matthiaswessendorf.wordpress.com/
sessions:
http://www.slideshare.net/mwessendorf
twitter:
http://twitter.com/mwessendorf
_______________________________________________
aerogear-dev mailing list
aerogear-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/aerogear-dev