I am developing android App in Xamarin. I want to create an interface and its implementing class in the UI layer. As you see in the below code, I am getting an error when ever, I use
this.GetSystemService(AudioService);
it is never recognized. please have a look at the imports below. please let me know how to get it working.
code:
public class ImplClass :
InterfaceFile
{
public bool IsAllowed(Context ctx)
{
AudioManager audioMgr =
(AudioManager)this.GetSystemService(AudioService);
}
}
import:
using System;
using System.Runtime.Remoting.Contexts;
using Android.Media;
using MvvmCross.Platform;
using Android.Content.PM;
You can use the "Application Context".
public class ImplClass : InterfaceFile
{
public bool IsAllowed(Context ctx)
{
AudioManager audioMgr = (AudioManager)Application.Context.GetSystemService(AudioService);
}
}