We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Xamarin accessibility service: Handle Numeric KeyPress

How do I Handle Physical Keyboard Numeric KeyPress in my accessiblity service, it seems I am missing something, the OnAccessibilityEvent method is not hitting when I press numeric keys on keyboard Here's my accesiblity serivice:
        public override void OnAccessibilityEvent(AccessibilityEvent e)
        {
            try
            {
                //if (e.PackageName == "livetvstream")
                //{
                    //final int eventType = event.getEventType();
                    //switch(eventType) {
                    //    case AccessibilityEvent.TYPE_VIEW_CLICKED:
                    //        do somthing
                    //        break;
                    //    case AccessibilityEvent.TYPE_VIEW_FOCUSED:
                    //        do somthing
                    //        break;
                    //}

                    Console.WriteLine("event type : " + e.EventType);

                    Console.WriteLine("content decription : " + e.ContentDescription);
                    Console.WriteLine("package name : " + e.PackageName);
                    Console.WriteLine("source : " + e.Source);
                    Console.WriteLine("window id : " + e.WindowId);
                    Console.WriteLine("event time : " + e.EventTime);

                    var strBuilderTxt = new StringBuilder();
                    foreach (var txt in e.Text)
                    {
                        strBuilderTxt.Append(txt);
                    }

                    Console.WriteLine("actual text : " + strBuilderTxt);
                //}
            }
            catch (Exception e2)
            {
                Console.WriteLine(e2.Message);
            }
        }

here's my git repo https://github.com/nitinjs/XamarinNumericPadAccessilbiity

1 Reply

RA Rachel A Syncfusion Team October 7, 2019 11:41 AM UTC

Hi Nitin, 
 
Greetings from Syncfusion. 
 
We have analysed in your sample and found that you have used Button. Are you checking the key press events by replacing with numeric text box please confirm us on that? So, we can proceed further on this. 
 
Also, please find some of the helpful link below to know more information on accessibility service for key press events. 
 
 
Thanks, 
Rachel. 


Loader.
Live Chat Icon For mobile
Up arrow icon