[aerogear-dev] Issues with Aerogear on Cordova

Matthias Wessendorf matzew at apache.org
Fri Feb 21 10:47:48 EST 2014


On Fri, Feb 21, 2014 at 4:45 PM, Miguel Lemos <miguel21op at gmail.com> wrote:

> Yes, of course it's different! That's why I said that it can not be sent
> in the middle of a Json array! But I just don't now how I can do it, right
> now :-(
>


$data = array(
    'message' => array(
        'atl'    => 'Aviso',
        'avs'    => 'Mensagem',
        'badge'    => 1
    )
);


using the http://phpepl.cloudcontrolled.com/ shows me this result:

{"message":{"atl":"Aviso","avs":"Mensagem","badge":1}}




>
>
>
> On Fri, Feb 21, 2014 at 3:35 PM, Matthias Wessendorf <matzew at apache.org>wrote:
>
>>
>>
>>
>> On Fri, Feb 21, 2014 at 9:54 AM, Miguel Lemos <miguel21op at gmail.com>wrote:
>>
>>> Hi!
>>>
>>> I'm trying to create a php batch to test faster my notifications. So I
>>> did this (simplified example):
>>>
>>> $ch = curl_init('https://aerogear-metalpush.rhcloud.com/rest/sender');
>>>
>>> $data = array(
>>>     'message' => array(
>>>         'atl'    => 'Aviso',
>>>         'avs'    => 'Mensagem',
>>>         'badge'    => '1'
>>>
>>
>>
>>
>> Can you log the JSON somewhere, on a console ?
>>
>> I am not sure for PHP..., but I am w/ Sebi that "1" is something
>> different than 1
>>
>> That said, putting "badge":"1" (string value) in, via curl does cause an
>> error on the server.
>>
>> Due to the async nature of notifcation delivery, we receive the message,
>> return HTTP 200, and process it.
>>
>> The "1" value does NOT work.
>>
>> -Matthias
>>
>>
>>
>>
>>>     )
>>> );
>>>
>>> $data_st = json_encode($data);
>>> $headers = array("Accept: application/json", "Content-Type:
>>> application/json");
>>> curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 6);
>>> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
>>> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
>>> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
>>> curl_setopt($ch, CURLOPT_USERPWD, "$key:$secret");
>>> curl_setopt($ch, CURLOPT_HTTPHEADER,
>>> $headers);
>>> curl_setopt($ch, CURLOPT_POSTFIELDS, $data_st);
>>>
>>> $result = curl_exec($ch);
>>>
>>> I think that's something wrong with the $data array because the server
>>> returns: "
>>> *The request sent by the client was syntactically incorrect (). *
>>>
>>> If I strip the string from the "message"  it returns "job submitted",
>>> but of course I don't receive nothing.
>>>
>>> Thanks again
>>>
>>> M
>>>
>>>
>>>
>>>
>>> On Thu, Feb 20, 2014 at 8:48 AM, Sebastien Blanc <scm.blanc at gmail.com>wrote:
>>>
>>>> This is really cool Miguel !
>>>> Don't hesitate to ask us other questions and also , like you did with
>>>> your screenshot, give us feedback !
>>>> Thanks again for your interest in the project.
>>>> Sebi
>>>>
>>>>
>>>>
>>>> On Thu, Feb 20, 2014 at 9:43 AM, Miiguel Lemos <miguel21op at gmail.com>wrote:
>>>>
>>>>> Not all, but a couple of steps on the right direction, I hope ;-)
>>>>>
>>>>> Enviado do meu iPad
>>>>>
>>>>> No dia 19/02/2014, às 21:20, Matthias Wessendorf <matzew at apache.org>
>>>>> escreveu:
>>>>>
>>>>> Nice!
>>>>>
>>>>> Glad you are all set!
>>>>>
>>>>> -Matthias
>>>>>
>>>>>
>>>>> On Wed, Feb 19, 2014 at 4:38 PM, Miguel Lemos <miguel21op at gmail.com>wrote:
>>>>>
>>>>>> A small souvenir ;-)
>>>>>>
>>>>>> Thanks again
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wed, Feb 19, 2014 at 3:20 PM, Miguel Lemos <miguel21op at gmail.com>wrote:
>>>>>>
>>>>>>> Hi Matthias,
>>>>>>>
>>>>>>> Maybe I didn't make myself clear, but your answer was clear enough
>>>>>>> to respond to my post :-)
>>>>>>>
>>>>>>> Thanks again.
>>>>>>>
>>>>>>> Carry on!
>>>>>>>
>>>>>>> M
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Feb 19, 2014 at 3:05 PM, Matthias Wessendorf <
>>>>>>> matzew at apache.org> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, Feb 19, 2014 at 3:43 PM, Miguel Lemos <miguel21op at gmail.com
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> Dear Matthias,
>>>>>>>>>
>>>>>>>>> According to the information posted in the url below, I can send
>>>>>>>>> (and read) several parameters / keys in the scope of the notification
>>>>>>>>> service (as it should be...):
>>>>>>>>>
>>>>>>>>> http://aerogear.org/docs/specs/aerogear-push-messages/
>>>>>>>>>
>>>>>>>>> According to the values on it, the receiver should have the
>>>>>>>>> capacity to decide what to do next.
>>>>>>>>>
>>>>>>>>> First, and the easiest thing: don't show  the "Alert" text, but
>>>>>>>>> any other part of  content received and / or change "Alert" to  another
>>>>>>>>> language, for instance.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Not sure I follow.
>>>>>>>>
>>>>>>>> The 'alert' is a keyword on iOS, which our server (and our Cordova
>>>>>>>> Libs) do recognize. What do you want to change there ?
>>>>>>>> For the completion of our spec, we are showing all of the keywords,
>>>>>>>> that are supported.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Second, if I create (for instance) a lat, lon and rad parameters,
>>>>>>>>> I can decide if I show the notification immediately, or only when the user
>>>>>>>>> reaches a matchable location, within a given radius.
>>>>>>>>> This is just an example of the freedom that must be available to
>>>>>>>>> decide what to do according to a given parameter that the software on the
>>>>>>>>> client's side can interpret. The message itself may not be the most
>>>>>>>>> important part of the whole thing...
>>>>>>>>>
>>>>>>>>
>>>>>>>> If you don't want or need that alert, simply leave it our of the
>>>>>>>> payload. It's just part of the demo/docs as that is quite handy to get
>>>>>>>> going.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> So, the question is: how can I read those parameters / keys before
>>>>>>>>> deciding to do with the notification? Through a "regular" object keys
>>>>>>>>> iterator? Thank you very much again. If there's some place in the
>>>>>>>>> documentation where I can understand that, please let me know.
>>>>>>>>>
>>>>>>>>
>>>>>>>> yes, like here (using alert just as an example):
>>>>>>>>
>>>>>>>>
>>>>>>>>  function onNotification(e) {
>>>>>>>>      alert(e.payload.foo);
>>>>>>>>      alert(e.payload.key);
>>>>>>>>   }
>>>>>>>>
>>>>>>>> And the curl for that would be something _like_ this:
>>>>>>>> curl -3 -u "ID:secrect" -v -H "Accept: application/json" -H
>>>>>>>> "Content-type: application/json" -X POST -d '{"message": {"foo":"bar
>>>>>>>> value", "key":"HELLO"}}'
>>>>>>>> https://something-doamin.rhcloud.com/rest/sender
>>>>>>>>
>>>>>>>>
>>>>>>>> -Matthias
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Miguel
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Feb 19, 2014 at 1:34 PM, Matthias Wessendorf <
>>>>>>>>> matzew at apache.org> wrote:
>>>>>>>>>
>>>>>>>>>> Awesome,
>>>>>>>>>>
>>>>>>>>>> we are interested in hearing your feedback.
>>>>>>>>>>
>>>>>>>>>> Good luck w/ the development process!
>>>>>>>>>>
>>>>>>>>>> -Matthias
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Feb 19, 2014 at 2:29 PM, Miguel Lemos <
>>>>>>>>>> miguel21op at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Thanks. Of course I'll give you my feedback ;-)
>>>>>>>>>>>
>>>>>>>>>>> I've some questions about the service as a whole, but I'll make
>>>>>>>>>>> some more testing and then I'll let you know.
>>>>>>>>>>>
>>>>>>>>>>> Thank you very much again for your attention.
>>>>>>>>>>>
>>>>>>>>>>> All the best,
>>>>>>>>>>>
>>>>>>>>>>> Miguel
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Feb 19, 2014 at 1:25 PM, Matthias Wessendorf <
>>>>>>>>>>> matzew at apache.org> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Wed, Feb 19, 2014 at 2:18 PM, Miguel Lemos <
>>>>>>>>>>>> miguel21op at gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Matthias,
>>>>>>>>>>>>>
>>>>>>>>>>>>> One of the biggest reasons I'm testing this solutions is
>>>>>>>>>>>>> because iOS!
>>>>>>>>>>>>>
>>>>>>>>>>>>> Once we already developed a full native Android push
>>>>>>>>>>>>> (considering geofencing)  notification service. The issue is to port our
>>>>>>>>>>>>> solution to iOS (not only the notifications, but everything). That's why
>>>>>>>>>>>>> I'm personally testing Cordova on Android and already partially on IOS. So
>>>>>>>>>>>>> far so good..
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Sounds very interesting. If you are interested, let us know how
>>>>>>>>>>>> it goes.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I'm starting with Android because it's easier to me. But next
>>>>>>>>>>>>> week I want to test your solution  with iOS. Why? Is there any problem?
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> No problem there at all :-) I was just curious if you target
>>>>>>>>>>>> Android first/only.
>>>>>>>>>>>>
>>>>>>>>>>>> Greetings,
>>>>>>>>>>>> Matthias
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>>> Miguel
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Wed, Feb 19, 2014 at 1:04 PM, Matthias Wessendorf <
>>>>>>>>>>>>> matzew at apache.org> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Wed, Feb 19, 2014 at 1:20 PM, Miguel Lemos <
>>>>>>>>>>>>>> miguel21op at gmail.com> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi all,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I tested and now it works, thanks.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> glad it all worked out
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> When I tried for  the first time, I tried with the function
>>>>>>>>>>>>>>> global, reflecting the Github example. But as it didn't work (because of
>>>>>>>>>>>>>>> the "damn" URL issue...) I tried several things, one of them being put the
>>>>>>>>>>>>>>> alert function inside the deviceready event. Of course, when I solved the
>>>>>>>>>>>>>>> URL thing I never more remembered to put it outside again...
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Things like that might happen.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regarding the URL, we will try to update the OpenShift blog
>>>>>>>>>>>>>> post.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I just checkout project documentation, and it looks like they
>>>>>>>>>>>>>> are already 'right'.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Wondering: Are you building Cordova clients for Android only,
>>>>>>>>>>>>>> or do you plan to use the iOS platform as well ?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Greetings,
>>>>>>>>>>>>>> Matthias
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> Matthias Wessendorf
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>>>>>>>>>>> sessions: http://www.slideshare.net/mwessendorf
>>>>>>>>>>>>>> twitter: http://twitter.com/mwessendorf
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Matthias Wessendorf
>>>>>>>>>>>>
>>>>>>>>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>>>>>>>>> sessions: http://www.slideshare.net/mwessendorf
>>>>>>>>>>>> twitter: http://twitter.com/mwessendorf
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Matthias Wessendorf
>>>>>>>>>>
>>>>>>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>>>>>>> sessions: http://www.slideshare.net/mwessendorf
>>>>>>>>>> twitter: http://twitter.com/mwessendorf
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> aerogear-dev mailing list
>>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> aerogear-dev mailing list
>>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Matthias Wessendorf
>>>>>>>>
>>>>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>>>>> sessions: http://www.slideshare.net/mwessendorf
>>>>>>>> twitter: http://twitter.com/mwessendorf
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> aerogear-dev mailing list
>>>>>>>> aerogear-dev at lists.jboss.org
>>>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> aerogear-dev mailing list
>>>>>> aerogear-dev at lists.jboss.org
>>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matthias Wessendorf
>>>>>
>>>>> blog: http://matthiaswessendorf.wordpress.com/
>>>>> sessions: http://www.slideshare.net/mwessendorf
>>>>> twitter: http://twitter.com/mwessendorf
>>>>>
>>>>> _______________________________________________
>>>>> aerogear-dev mailing list
>>>>> aerogear-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> aerogear-dev mailing list
>>>>> aerogear-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> aerogear-dev mailing list
>>>> aerogear-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>>
>>>
>>>
>>> _______________________________________________
>>> aerogear-dev mailing list
>>> aerogear-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>>
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>> _______________________________________________
>> aerogear-dev mailing list
>> aerogear-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>>
>
>
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev
>



-- 
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/20140221/f3a8d467/attachment-0001.html 


More information about the aerogear-dev mailing list