Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Send Bell on a Scanner with MobileApp

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Vienna, Austria
    Posts
    582

    Default Send Bell on a Scanner with MobileApp

    Hi!

    We have a mobile app run on a browser on a scanner. And we want to run a beep when there is an error. When I do "Send Bell" then the sound is on the server but not on the scanner. Any idea what I can do?

    Regards
    Peter

  2. #2
    Join Date
    Feb 2009
    Location
    Stuart, FL
    Posts
    5,321

    Default Re: Send Bell on a Scanner with MobileApp

    you will need to send a javascript message to cause the bell on the client

    as far as i know JS doesnt have a bell or similar so you need to create an audio object and play an mp3 file
    Michael Salzlechner
    StarZen Technologies, Inc
    http.://www.starzen.com

    IT Director at Balloons Everywhere

    Development Blog
    http://www.salzlechner.com/dev

    DataFlex Package Manager (aka Nuget for DataFlex)
    http://windowsdeveloper.com/dfPackage

  3. #3
    Join Date
    May 2018
    Location
    DAE Hengelo
    Posts
    190

    Default Re: Send Bell on a Scanner with MobileApp

    You could make a simple small script in your index.html like so:

    Code:
        <script>
            const playAudio = () => {
                const audio = new Audio('relative/path/to/your/audio_file.mp3');
                audio.play();
            }
        </script>
    
    Then call "playAudio" using "psClientClientOnClick" or something similar. I'd probably just drop the mp3 file in the AppHtml folder.

  4. #4
    Join Date
    Feb 2009
    Location
    Vienna, Austria
    Posts
    582

    Default Re: Send Bell on a Scanner with MobileApp

    Thank you, I will try it.
    Regards
    Peter

  5. #5
    Join Date
    Feb 2009
    Location
    Vienna, Austria
    Posts
    582

    Default Re: Send Bell on a Scanner with MobileApp

    Hi Henri!

    I added this in the index.html in the AppHtml folder in the <head> section (where all the other scripts are)
    <script> const playAudio = () => {
    const audio = new Audio('sample.mp3');
    audio.play();
    }
    </script>
    The sample.mp3 file I also added to the AppHtml folder

    In my app I added Send ClientAction "playAudio" in the OnBlur procedure of a field

    Then I get the error msg: Action method not found "playAudio"

    What I am doing wrong?

    Best regards
    Peter

  6. #6
    Join Date
    Feb 2009
    Location
    Brazil
    Posts
    5,446

    Default Re: Send Bell on a Scanner with MobileApp

    Cache ?

    Make sure the index.html loaded is the "changed" one using f12, source-code.
    Samuel Pizarro

  7. #7
    Join Date
    May 2018
    Location
    DAE Hengelo
    Posts
    190

    Default Re: Send Bell on a Scanner with MobileApp

    I don't think "Send ClientAction 'playAudio' " will work as the method is not part of the invoking control but rather a generic piece of script. You can call this piece of script by setting psClientOnBlur to the name of the method (playAudio).

    I tried to keep the example as simple as possible to avoid having to write your own control logic in JS. If you want to go the "Send ClientAction" route, thats what you'll have to do but i'd advise against it in this case.

  8. #8
    Join Date
    Feb 2009
    Location
    The Netherlands
    Posts
    4,674

    Default Re: Send Bell on a Scanner with MobileApp

    Change the JavaScript into:
    Code:
    <script> 
    function playAudio(){
        const audio = new Audio('sample.mp3');
        audio.play();
    }
    </script>
    And you can call it using Send ClientAction "playAudio" or Send ClientAction "window.playAudio" just fine...

    Note that for both ClientAction and psClient.. you can use the 'window.' to specify global functions. To explicitly call local functions (of the object only) you can use 'this.' and if nothing is specified it will first look for a local function and then for a global function.

  9. #9

    Default Re: Send Bell on a Scanner with MobileApp

    That´s a great explanation.

    Thanks Harm.
    --
    Wil

  10. #10
    Join Date
    Feb 2009
    Location
    Vienna, Austria
    Posts
    582

    Default Re: Send Bell on a Scanner with MobileApp

    Thank you, Harm, that works fine!
    Regards
    Peter

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •