Code example for Instrumentation

Methods: sendKeyDownUpSync

0
         appContext.sendOrderedBroadcast(i, null);
      } 
   } 
 
   private void instrumentKey(int keyEvent) {
      Instrumentation instrumentation = new Instrumentation();
      try { 
         instrumentation.sendKeyDownUpSync(keyEvent);
      } catch (SecurityException e) {
         // some other app is front, ignore. 
      } 
   } 
    
   /** 
    * set device connection state through reflection for Android 2.1, 2.2, 2.3, 
    * maybe others. Thanks Adam King! 
    *  
    * @param device 
    * @param state 
    * @param address 
Connect your IDE to all the code out there  Get Codota for Java