iOS Code Snippet Play SystemSounds (and Vibration)

Hi, i found this post on the forum from @aeric

I slightly modified it to play every sound you want from the systemsounds of iOS, by passing the ID.
The id list can be found here: iOSSystemSoundsLibrary

B4X:
Sub PlaySystemSound(id As Int)
    Dim NativeMe As NativeObject = Me
    NativeMe.RunMethod("play:", Array(id))
End Sub
#If ObjC
#import <AVFoundation/AVAudioPlayer.h>
- (void) play: (int) id{
  AudioServicesPlaySystemSound(id);
}
#End If


Don't forget to put this in Region Attributes (main):
B4X:
#IgnoreWarnings: 32

Maybe can be useful
 
Top