Search code examples
c#androidiosxamarinbeep

Xamarin using Beep()


I'm trying to add a beep sound to my Android and IOS project. But eveything I try fails. I've used this and a lot other articles but without any success.

If I put in the code: public static Void Beep () I will get the error:

System.Void cannot be used from C# -- use typeof(void) to get the void type object

And

Page_BarcodeScanner.Beep() must declare a body because it is not marked abstract, extern or partial

I hope anyone can push me in the right direction, since I'm already stuck for 2 days.


Solution

  • If you use Xamarin Forms I think you have to use DependencyServices to play a sound.

    In Android you can take a look to Play Audio Android

    in iOS AvAudioPlayer

    I think this prj can be useful as starting point SimpleAudioForms