PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WM21] app crashes after receiving push notification
[WM21] app crashes after receiving push notification
Iniciado por guest, 29,jul. 2017 02:56 - 3 respuestas
Publicado el 29,julio 2017 - 02:56
Hi everyone,

Why when I send a push notification to my App this crashes. This did not happen a few days ago. When I copy the same procedure in any other test app, it works correctly.

Any suggestions?

Thank you.
Publicado el 31,julio 2017 - 09:00
Hi,

For more stability,
I have set the Notification Parameter to LOCAL because the OnPushNotificationReceived call back function is called on a new thread and then it is best to use LOCAL parameters because you don't know when the referenced variable is going out of scope in the process that has started the thread and may cause problems.

I Also include a WHEN EXCEPTION DO END so if anything happens in my processing the notification I can catch that and log it.

Don't directly call any GUI stuff in the procedure, you have to call that on the main thread -> This sometimes works, sometimes does not. But you have to check that yourselfs, even in subfunctions that are calles from this push notification function, you have to make sure you only touch the GUI from the main thread.EXECUTEMAINTHREAD

What do you do inside your OnPushNotificationsReceived procedure ?

Danny
Publicado el 31,julio 2017 - 23:56
Quote
Danny Lauwers

Hi,





For more stability,


I have set the Notification Parameter to LOCAL because the OnPushNotificationReceived call back function is called on a new thread and then it is best to use LOCAL parameters because you don't know when the referenced variable is going out of scope in the process that has started the thread and may cause problems.





I Also include a WHEN EXCEPTION DO END so if anything happens in my processing the notification I can catch that and log it.





Don't directly call any GUI stuff in the procedure, you have to call that on the main thread -> This sometimes works, sometimes does not. But you have to check that yourselfs, even in subfunctions that are calles from this push notification function, you have to make sure you only touch the GUI from the main thread.EXECUTEMAINTHREAD





What do you do inside your OnPushNotificationsReceived procedure ?





Danny


Hi, Danny,
I only use the notification to report some action, I do not execute any procedure.

A few days ago it worked without problems, not now.

Any other suggestions?
Publicado el 02,agosto 2017 - 17:20
Hi,

No, at the moment. Could you show us the code of the function that handles the push notifications. And can you see what the error message is ? Android logcat ?

Danny