PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Push Notifications
Push Notifications
Débuté par Marius, 30 jan. 2017 22:20 - 11 réponses
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
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
Membre enregistré
19 messages
Popularité : +2 (2 votes)
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
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)||
Membre enregistré
19 messages
Popularité : +2 (2 votes)
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
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.
Membre enregistré
19 messages
Popularité : +2 (2 votes)
Posté le 15 juin 2017 - 07:08
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
Posté le 15 juin 2017 - 10:34
can you give a bit more detail on this?
Membre enregistré
19 messages
Popularité : +2 (2 votes)
Posté le 15 juin 2017 - 13:20
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
Membre enregistré
19 messages
Popularité : +2 (2 votes)
Posté le 15 juin 2017 - 15:44
Posté le 17 juin 2017 - 06:04
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
Membre enregistré
19 messages
Popularité : +2 (2 votes)
Posté le 19 juin 2017 - 17:10
Marius,

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

Thanks again.

--

Yogi Yang