List of usage examples for android.hardware.input InputManager getInputDeviceIds
public int[] getInputDeviceIds()
From source file:org.gearvrf.weartouchpad.WearInputService.java
@Override public void onCreate() { super.onCreate(); apiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).build(); apiClient.connect();// w w w . ja v a 2 s . c o m nodes = new HashSet<Node>(); receiveMessenger = new Messenger(new IncomingMsgHandler()); broadcastManager = LocalBroadcastManager.getInstance(this); localBinder = new LocalBinder(); connectedToWatch = false; int touchScreenDeviceId = 0; InputManager im = (InputManager) getSystemService(Context.INPUT_SERVICE); for (int inputDevId : im.getInputDeviceIds()) { InputDevice inputDevice = im.getInputDevice(inputDevId); if ((inputDevice.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) { touchScreenDeviceId = inputDevId; break; } } motionEventGenerator = new MotionEventGenerator(touchScreenDeviceId); }