PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → Push Notifications
Push Notifications
Started by Marius, Jan., 30 2017 10:20 PM - 11 replies
Registered member
2 messages
Posted on January, 30 2017 - 10:20 PM
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
Registered member
2 messages
Posted on January, 31 2017 - 7:06 PM
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
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on April, 22 2017 - 8:23 AM
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
Posted on April, 24 2017 - 9:46 AM
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)||
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on April, 24 2017 - 5:09 PM
Hello,

Can we use this from php script running on server?

Or is it only usable from mobile phone?

TIA

--

Yogi Yang
Posted on April, 25 2017 - 5:34 AM
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.
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on June, 15 2017 - 7:08 AM
Hello,
"registration_ids": ["Aki9 ... yXgt","BTh44 ... iQW)"]


Can you tell me as to how did you manage to sanitize the registration ids please?

TIA

--

Yogi Yang
Posted on June, 15 2017 - 10:34 AM
can you give a bit more detail on this?
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on June, 15 2017 - 1:20 PM
In my case the Registration ID that gets generated by Android app developed in WM comes up like this:
偁㥁戱杆䡬䡷瀶䕭捧瑍煳䵰䙟匲昶瘶䡂慥䅙彵䩷䅵塳䕍㝧版佃㉅㑰䕴癁㑊䅓娸䵹䍌䥶獄慯佈晵䌳祖䕺䅦扳䕓䝢祲㥂睚癦癯砰即湍啁䅹捓畣㙉坎煢彦呫㑭㡮湅䱶湏獗㡎䱤䰷攳䭤坖偦昷歕杚


Actually I got a Android developer to build a small sample for me that would register for Push notification with GCM as well as send the Registration ID to a PHP script . This PHP script in turn will store the Registration ID in MySQL database.

The Registration ID as generate by the WM is as give above and on the same mobile the Registration ID as generated by the app developed by Android developer is in alpha numeric.

It seems I am making a very small mistake in my WM coding.

How can I convert the above (binary) Registration ID in a human readable Alpha numeric string?

TIA

--

Yogi Yang
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on June, 15 2017 - 3:44 PM
Posted on June, 17 2017 - 6:04 AM
Hi Yogi

it looks like your problem is with Unicode if i look at your other post.

maybe for the registration id , try declaring a variable as a string as ANSI and assigning it to the registration id that windev returns.
i am not sure if it will work, but maybe wort trying atleast.

thanx
marius
Registered member
19 messages
Popularité : +2 (2 votes)
Posted on June, 19 2017 - 5:10 PM
Marius,

Thanks for your invaluable help. Finally I have managed to solve the problem and things are working properly. :)

Thanks again.

--

Yogi Yang