PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 21 → Push Notifications
Push Notifications
Débuté par Marius, 30 jan. 2017 22:20 - 5 réponses
//hostimage.webdev.info/avatars/UjH1PuBECdLWUgOQd3lDgg
Membre enregistré
2 messages
Posté le 30 janvier 2017 - 22:20
Hi ,
I am using windev mobile 21.
i got GCM messaging to work with and oracle xe database sending it to the mobile device, but for some reason some of the parameters in the json are not read when it comes through on the mobile side, for example the content (WX_PROP_CONTENT).
Even if i use the following json , (with just my registration id) , i get the message but not any other value or the activate application does not fire. :
{
"registration_ids": ["Aki9 ... yXgt","BTh44 ... iQW)"],
"data":
{
"WX_PUSH_EXT_VERSION":"1.0",
"WX_PROP_TITLE":"Title of the notification",
"WX_PROP_MESSAGE":"Message of the notification",
"WX_PROP_ACTIVATEAPPLICATION":true,
"WX_PROP_FORMAT":
{
"WX_PROP_TYPE":1,
"WX_PROP_CONTENT":"Message of the notification\r\non two lines",
}
}
}

can anybody please help, what am i missing?
thanx
//hostimage.webdev.info/avatars/UjH1PuBECdLWUgOQd3lDgg
Membre enregistré
2 messages
Posté le 31 janvier 2017 - 19:06
After alot of searching i found the problem and thought i should share it.

when pushing the message from the database the specific variables in the payload that windev uses for notification , some of the variables need to be in french and not english, then it works normal.

content := '{' ||chr(10)||
'"registration_ids":["'||v_mc_row.android_api_token||'"],'||chr(10)||
'"data":'||chr(10)||
'{'||chr(10)||
'"WX_PUSH_EXT_VERSION":"1.0",'||chr(10)||
'"WX_PROP_CONTENU":"Messageone",'||chr(10)||
'"WX_PROP_TITRE":"Title of the notification",'||chr(10)||
'"WX_PROP_MESSAGE":"Message of the notification",'||chr(10)||
'"WX_PROP_ACTIVEAPPLICATION":true,'||chr(10)||
'"WX_PROP_AFFICHAGELED":true,'||chr(10)||
'"WX_PROP_FORMAT":'||chr(10)||
'{'||chr(10)||
'"WX_PROP_TYPE":1,'||chr(10)||
'"WX_PROP_CONTENU":"Message of the notification\r\non two lines"'||chr(10)||
'}'||chr(10)||
'}'||chr(10)||
'}';

and not like the documentation says in english .

thanx
//hostimage.webdev.info/avatars/HstkaHNb3hGx0SW3hxWAiA
Membre enregistré
2 messages
Posté le 22 avril 2017 - 08:23
Hello Marius,

I am also suffering from Push Notifications. I am not able to get Push Notifications working in my apk.

Thanks for posting here. I will try this out. In fact you post made me aware that I have to build a header for sending push notification from a web server.

But will this work from a PHP web application?

TIA

--

Yogi Yang
//hostimage.webdev.info/avatars/default.gif
Posté le 24 avril 2017 - 09:46
yes it should still work from pho, the main portion is just to use the right variable names and not what it says in the documentation, this is the one portion they forgot to translate :

for example the documentation shows you should call : WX_PROP_CONTENT but in fact it is WX_PROP_CONTENU

'"WX_PUSH_EXT_VERSION":"1.0",'||chr(10)||
'"WX_PROP_CONTENU":"Messageone",'||chr(10)||
'"WX_PROP_TITRE":"Title of the notification",'||chr(10)||
'"WX_PROP_MESSAGE":"Message of the notification",'||chr(10)||
'"WX_PROP_ACTIVEAPPLICATION":true,'||chr(10)||
'"WX_PROP_AFFICHAGELED":true,'||chr(10)||
'"WX_PROP_FORMAT":'||chr(10)||
'{'||chr(10)||
'"WX_PROP_TYPE":1,'||chr(10)||
'"WX_PROP_CONTENU":"Message of the notification\r\non two lines"'||chr(10)||
'}'||chr(10)||
'}'||chr(10)||
//hostimage.webdev.info/avatars/HstkaHNb3hGx0SW3hxWAiA
Membre enregistré
2 messages
Posté le 24 avril 2017 - 17:09
Hello,

Can we use this from php script running on server?

Or is it only usable from mobile phone?

TIA

--

Yogi Yang
//hostimage.webdev.info/avatars/default.gif
Posté le 25 avril 2017 - 05:34
the script i have is for an oracle database, i think you can just alter it for php format to run it from the server and it should work.