Page 1 of 1

Android application freezes

Posted: January 14th, 2026, 9:34 pm
by Harry
Dear CSPRO team,
I am moving one application from CSPRO 7.7.3 to CSPRO 8, it works fine on Windows, but it freezes on Android. After a detailed analysis, I found the issue is produced by a skip from one function called by a javascript:CSPro.runLogicAsync instruction. As the application is big, I wrote a very tiny application showing the issue. It has only two fields, the first one call the second one. The second one only shows a message telling that the application arrived there. It works on Windows but it freezes on Android before shows the message.

I am attaching this tiny application for your review.

Thanks
Harry Hernandez

Re: Android application freezes

Posted: January 15th, 2026, 5:24 pm
by Gregory Martin
Wow, this was an interesting bug. Thanks for isolating it to just a small amount of code. That definitely makes it easier to debug. After most of today looking into this, I figured out and fixed the problem.

First, I'm not sure if there is an easy workaround, but here is an option for you to try. (I couldn't fully test it because I don't have a device that has 8.0 on it. I only have devices with the currently-in-development 8.1.) Go to Options -> Application Properties -> Advanced Features and disable HTML dialogs: https://www.csprousers.org/help/CSPro/p ... tures.html

This might work, but I can't guarantee it. The issue is that when you call CSPro.runLogicAsync, it runs in a background thread, and then when you execute skip, that thread indicates that CSEntry should refresh the current field. The code to refresh the current field is improperly run in the UI thread rather than in another background thread. When the UI thread tries to get the current field, it runs your second field's preproc, which tries to show an error message, which has to happen on the UI thread. So now two things are trying to execute on the UI thread, leading to a deadlock.

This is all a bit technical, but if you care to see this, you can call errmsg and then call skip and it will work. By using non-HTML dialogs, this may solve your issue, but I am not so sure.

So, what are the actual solutions available to you?

1) Wait a couple weeks until the CSPro 8.1 beta is released in Google Play. This will fix the issue. We plan to put out a beta on February 5.

2) Or, do not call errmsg in the preproc of any field that you skip to when using this JavaScript functionality from question text. Unfortunately, I understand that error messages can be very useful for debugging your issue.

In the meantime, you should refactor any uses of the CSPro.[JavaScript functions] to use the Action Invoker. The 7.7 way of using JavaScript works in 8.0, but has been removed for 8.1. You can read more about the new way here:

https://www.csprousers.org/help/CSPro/a ... t_web.html

Here is how you can run your code in 8.0 / 8.1:
<a href="#" onclick="javascript:myFunction(1);">Action</a>
<br><br>
<a
href="#" onclick="javascript:myFunction(2);">End</a>

<script
src="/action-invoker.js"></script>

<script>

  const CS = new CSProActionInvoker();

  function myFunction(action) {
    CS.Logic.invokeAsync({
      function: "myFunction",
      arguments: {
        action: action
      }
    });
  }
</script>
See attached for the application.
cspro8issue-action-invoker.zip

Re: Android application freezes

Posted: January 15th, 2026, 11:31 pm
by Harry
Thanks Gregory for your quick response, but I have bad news. I tried turning off the "Use HTML dialogs" and does not work. I also tested your solution using the Action Invoker and it doesn't work either.
This issue happens not only when skips to a field, from the function invoked by JavaScript, has errmsg in the preproc. It happens when in the preproc or onfocus there are displaying windows commands, like htmldialog and selcase.
So, I have to decide if wait for Cspro 8.1 or rebuild the logic of all the system, avoiding this kind of instructions.
Thanks,
Harry

Re: Android application freezes

Posted: January 16th, 2026, 12:07 pm
by Gregory Martin
Ahh, that's too bad about the non-HTML dialogs.

I'm sorry that it sounded like the Action Invoker would fix it. The old JavaScript interface is simply translated to use the Action Invoker code path, so I knew that would not fix it. What I am suggesting is that you should start changing your code to use that anyway so that it is compliant with CSPro 8.1. It also gives you a lot more functionality than the old JavaScript interface.

When will your survey go into the field? If soon, I can see if we can push out a 8.0 fix next week. If not anytime soon, I can send you an 8.1 alpha this weekend that you can use for testing. That will be better than you rebuilding your logic to avoid this kind of code.

Re: Android application freezes

Posted: January 16th, 2026, 1:47 pm
by Harry
Thanks Gregory again for your quick response.
The survey has been used for the last two years in several countries, using Cspro 7.7.3. We want to move it to Cspro 8.0 to avoid the automatic updates on some tablets to Csentry 8.0, which causes a lot of issues. But now that you are telling us that Cspro 8.1 is almost ready, it is better to move directly to it, otherwise we will face the same problem (automatic updates from 8.0 to 8.1).
If you send me the alpha version of 8.1 I can start the conversion and play with it.
Thanks
Harry

Re: Android application freezes

Posted: January 20th, 2026, 8:37 am
by Gregory Martin
Here is a .apk with the code as of 2026-01-20. It is a debugging .apk, so it is larger than normal, but you should be able to use it for testing until we put out the beta release in a couple weeks.

https://drive.google.com/file/d/1-YiH-D ... drive_link

MD5: a760d76138b3ae4be79b7bf058cc73ff

Re: Android application freezes

Posted: January 22nd, 2026, 1:43 pm
by Harry
Thanks Gregory