title: Detect keyboard is active outside the application on android
body: <p>I am trying to detect keyboard is active or not (Outside my application) using accessibility service. For that i tried to read the notifications "choose keyboard" (When multiple key board are enabled). Following code is used.</p>
  
  <pre><code>public class KeyboardWatcher extends AccessibilityService {
  
  boolean isConnected = false;
  @Override
  public void onAccessibilityEvent(AccessibilityEvent event) {
      if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) {
          final String packagename = String.valueOf(event.getPackageName());
          Log.d("Package", packagename);
          String msg = "";            
          List&lt;CharSequence&gt; s = event.getText();
          if(s.iterator().hasNext())
          {
              msg += s.iterator().next().toString();
              Log.d("MSG", msg);
  
          }else{
              Log.d("TYPE", event.getEventType()+"");
          }
      }else{
          Log.d("EVENT TYPE__",event.getEventType()+"");
          final String packagename = String.valueOf(event.getPackageName());
          Log.d("PNE", packagename);          
      }
  
  }
  protected void onServiceConnected() {
  
      if (isConnected) {
          return;
      }       
      AccessibilityServiceInfo info = new AccessibilityServiceInfo();
      info.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
      info.feedbackType = AccessibilityServiceInfo.FEEDBACK_ALL_MASK;
      setServiceInfo(info);
      isConnected = true;
  } 
  }
  </code></pre>
  
  <p>Now all notifications are logged by the application except "keyboard chooser" notification. How to read that notification, is that possible.</p>
  
  <p>Thanks </p>