Android Question Wait For - my first tests

luke2012

Well-Known Member
Licensed User
Longtime User
Hi All,
I'm trying the new feature "wait for" and I did a couple of test projects:

1) A simple HttpUtils2 project with "wait for" (see "download_wait_for.zip")
2) A modded "b4aZXScannerLiveView" project using wait for (see "b4aZXScanner_wait_for.zip")

Project "download_wait_for" run successfully.

The problem:

The project "b4aZXScanner_wait_for" doesn't run successfully because I can't see the logs and I got the following error: "Unexpected event (missing RaiseSynchronousEvents): zxslv_scanner_stopped".
I'm try to understand why. I think that the code is correct (I'm wrong?)
 

Attachments

  • download_wait_for.zip
    6.7 KB · Views: 187
  • full_stack_trace.txt
    6.3 KB · Views: 269
  • b4aZXScanner_wait_for.zip
    19.1 KB · Views: 161

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. There is a missing annotation of @RaiseSynchronousEvents on StopScanner method (in the library).
2. The event is raised immediately when you call StopScanner. I haven't checked your code but if it looks like:
B4X:
Scanner.StopScanner
Wait For event_here
Then it will not work as the event has already been raised before the Wait For line.

The best solution for the two points above is to change the library and use raiseEventFromUI instead of raiseEvent.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Hi All,
I'm trying the new feature "wait for" and I did a couple of test projects:

1) A simple HttpUtils2 project with "wait for" (see "download_wait_for.zip")
2) A modded "b4aZXScannerLiveView" project using wait for (see "b4aZXScanner_wait_for.zip")

Project "download_wait_for" run successfully.

The problem:

The project "b4aZXScanner_wait_for" doesn't run successfully because I can't see the logs and I got the following error: "Unexpected event (missing RaiseSynchronousEvents): zxslv_scanner_stopped".
I'm try to understand why. I think that the code is correct (I'm wrong?)
Not sure what your issue is in this case. The lib returns the scan result to the B4A project as soon as what it has found a valid scan. Why do you want to make use of WAIT_FOR? I can change the lib as per Erel's suggestion but I need to understand why this is required.
 
Upvote 0

luke2012

Well-Known Member
Licensed User
Longtime User
Not sure what your issue is in this case. The lib returns the scan result to the B4A project as soon as what it has found a valid scan. Why do you want to make use of WAIT_FOR? I can change the lib as per Erel's suggestion but I need to understand why this is required.

@Johan Schoeman my case is only a test.
Your lib works fine (without wait for) so isn't mandatory to modify it to let it work with wait for :)

But if it works fine also with new b4x feature "wait for" I donate for sure (because I like your lib and also the "wait for") :)
 
Upvote 0
Top