karld Active Member Licensed User Longtime User Jul 25, 2016 #1 I have been porting over my b4a app to b4i. I have the user interface all converted and most of the logic. What is stumping me at this point is how to have an audible click when a button is pressed. I have a custom keyboard for entering error codes and it would be nice to have audible feedback on key presses.
I have been porting over my b4a app to b4i. I have the user interface all converted and most of the logic. What is stumping me at this point is how to have an audible click when a button is pressed. I have a custom keyboard for entering error codes and it would be nice to have audible feedback on key presses.
Erel B4X founder Staff member Licensed User Longtime User Jul 25, 2016 #2 You can use the code posted here: https://www.b4x.com/android/forum/t...-to-play-with-media-player.67075/#post-424638 Pass 1104 as the sound id. Upvote 0
You can use the code posted here: https://www.b4x.com/android/forum/t...-to-play-with-media-player.67075/#post-424638 Pass 1104 as the sound id.
karld Active Member Licensed User Longtime User Jul 26, 2016 #5 This worked great in development mode. When I try to compile to release mode for testing it fails. When I comment out the code for the audio it compiles . Upvote 0
This worked great in development mode. When I try to compile to release mode for testing it fails. When I comment out the code for the audio it compiles .
JanPRO Well-Known Member Licensed User Longtime User Jul 26, 2016 #6 Hi, try this code, I have added the framework import: Code: Copy Sub PlayNotification (id As Int) Dim no As NativeObject = Me no.RunMethod("playNotification:", Array(id)) End Sub #if objc #import <AudioToolbox/AudioToolbox.h> - (void)playNotification:(int)soundId { AudioServicesPlaySystemSound(soundId); } #end if Jan Upvote 0
Hi, try this code, I have added the framework import: Code: Copy Sub PlayNotification (id As Int) Dim no As NativeObject = Me no.RunMethod("playNotification:", Array(id)) End Sub #if objc #import <AudioToolbox/AudioToolbox.h> - (void)playNotification:(int)soundId { AudioServicesPlaySystemSound(soundId); } #end if Jan
karld Active Member Licensed User Longtime User Jul 28, 2016 #7 JanPRO said: Hi, try this code, I have added the framework import: Code: Copy Sub PlayNotification (id As Int) Dim no As NativeObject = Me no.RunMethod("playNotification:", Array(id)) End Sub #if objc #import <AudioToolbox/AudioToolbox.h> - (void)playNotification:(int)soundId { AudioServicesPlaySystemSound(soundId); } #end if Jan Click to expand... This worked perfectly! Thanks. Upvote 0
JanPRO said: Hi, try this code, I have added the framework import: Code: Copy Sub PlayNotification (id As Int) Dim no As NativeObject = Me no.RunMethod("playNotification:", Array(id)) End Sub #if objc #import <AudioToolbox/AudioToolbox.h> - (void)playNotification:(int)soundId { AudioServicesPlaySystemSound(soundId); } #end if Jan Click to expand... This worked perfectly! Thanks.