[aerogear-dev] Geottagged notifications

Matthias Wessendorf matzew at apache.org
Mon Feb 24 13:21:58 EST 2014


On Mon, Feb 24, 2014 at 7:14 PM, Matthias Wessendorf <matzew at apache.org>wrote:

>
>
>
> On Mon, Feb 24, 2014 at 6:36 PM, Miguel Lemos <miguel21op at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140224/ca924a5f/attachment.html 


More information about the aerogear-dev mailing list