Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 10 Monaten
Letzter Beitrag:
vor 1 Jahr, 10 Monaten
Beteiligte Autoren:
Ruben Sanchez Peña, Danny Lauwers, Fabrice Harari

Broadcast Receiver and CallWlProcedure

Startbeitrag von Ruben Sanchez Peña am 27.09.2016 18:07

Hi. In the thread http://27130.foren.mysnip.de/read.php?27131,483635 i can found the info for implement a BroadcastReceiver to fire an alarm and execute a code for it.

How i must write the code i want execute when the alarm fire?

I tried to use CallWlProcedure to execute a app global procedure, but the app crash it an activity is not running or the app is not running in background.

Anybody can share a working code sample where i could see how it must work?

Thank you



Hi Ruben

I would think (not tested) that in order to implement that, yo wouldneed to use a persistant trhead so that your app is ALWAYS there in the background, ready to receive the alarm

Best regards

von Fabrice Harari - am 27.09.2016 18:58
Hi Fabrice, thank you for your info. Persistent Thread was my first try. But then i must execute the app when de device start or open the app to launch the thread. For some extraneous reason if my app start with device and i have a persistent thread running then when i tap the app to open it, then it doesn't open and in the log i can see the app is blocked (not the exact words).

With Broadcast Receiver i can program an alarm and wake the device to execute a code. Noting is running in background and nothing must be executed when the device start to run.

My issue is when the alarm is fired and i must call to WM code from Java.

My current only is execute again the app to execute my code when the app is loaded, but i'm sure must exist a better mode.


von Ruben Sanchez Peña - am 27.09.2016 20:41

What is the purpose of your application, you probably need to open it to set the alarms or times it needs to do the actions ?

What WM version are you on ? In v19/20 I have tried to do the same and call CallWlProcedure to execute my own WLanguage procedure to do some other stuff, but that did not work, the procedure was never found.

But I have tested, but its been a while so I don't know fur sure anymore that if you use the full qualified JAVA name (like you had to use also to define your broadcastreceiver), and also the name you will find in the classes generated by WM for your function that you want to call, it did work in that little test.

So you need something like this:


Where GWDCPCOL_Java is the name for the global procedures called COL_JAVA that you see in you WM editor project.

Hope you get it working

von Danny Lauwers - am 28.09.2016 08:30
Hi Danny. Im using WM21.

I use your fantastic code for Broadcast Recever and now i need call a WM procedure from the Java code.

I have a global procedure to execute a query in a internet page, parse the text and advise to user if a word is present in the page text. I can run the procedure from a button in a Activity window and it works fine. But, if i call it from Java with CallWlProcedure then the app hang.

I will try including the global procedures file name, but i think i tried it without luck.

Thank you


von Ruben Sanchez Peña - am 28.09.2016 18:19
Hi again. I tried to add the global procedures file name to my called procedure without luck.

I tried too to call from Java source code to the static Class and Procedure generated by WM without luck too.

any idea more?

Thank you


von Ruben Sanchez Peña - am 29.09.2016 14:26
Hi again. After various tries with Broadcast receiver and WM21 i must forgive this option and try again the Persistent Thread option.

After rewrite the code i haven't Android errors of "app blocked" when i try to open the app while the Persistent Thread are runing and i have the "start running with Android" option checked.

Thank you for your help.


von Ruben Sanchez Peña - am 05.10.2016 11:13
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.