Search code examples
c#xamarin.formskeyboard

How to get all enabled keyboard in xamarin.forms with C#


Good day,

in android phone -> virtual keyboard, system list all the enabled keyboards in this page, how can i get all enabled keyboards type with C# in my Xamarin.forms APP?

Thanks! Roll


Solution

  • In Android, you could use InputDevice.

    InputDevice: https://developer.android.com/reference/android/view/InputDevice

    You could try the code below:

    int[] devicesIds = InputDevice.GetDeviceIds();
            foreach (var item in devicesIds)
            {
                //Check the device you want
                InputDevice device = InputDevice.GetDevice(item);
                //device.getName must to have virtual
                var s = device.Name;
                var b = device.KeyboardType;
            }
    

    You could use DependencyService to call this in Xamarin.Forms.

    DependencyService: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction