ibm mobilefirst - How to get data from notifications in hybrid app using Worklight and Cordova plugin -
i writing hybrid application ibm mobilefirst 8.5 , cordova plugin , don't know how data notifications.
i want create list containing data notifications within app. possible using cordova or ibm mobilefirst? remember possible when used e.g. java on android platform using handler.
all tutorials show "how push notification" app didn't find tutorial "how data notification within app".
there no such release "mobilefirst 8.5". there's either 6.3 or 7.0...
additionally, not send notifications app, receive them in app. tutorials show how handle (display) notifications in app. sample apps accompany tutorials put notification's payload (the text sent via notification) in alert - else you'd it.
so example, in hybrid sample app there following code:
// handle received notification function pushnotificationreceived(props, payload) { alert("pushnotificationreceived invoked"); alert("props :: " + json.stringify(props)); alert("payload :: " + json.stringify(payload)); }
instead of displaying notification's props
, payload
in alert take content , put it in table...
assuming have table in index.html now:
<table id="mytable"> </table>
then in main.js find , insert content it:
function pushnotificationreceived(props, payload) { $("#mytable").html( "<tr>" + json.stringify(payload) + " " + json.stringify(props) + "</tr>"); }
this simple abstract of could/should in order display push contents inside table upon handling it. you'll need further enhance it.
Comments
Post a Comment