Class ShadowSensorManager

    • Field Detail

      • forceListenersToFail

        public boolean forceListenersToFail
    • Constructor Detail

      • ShadowSensorManager

        public ShadowSensorManager()
    • Method Detail

      • removeSensor

        public void removeSensor​(Sensor sensor)
      • hasListener

        public boolean hasListener​(SensorEventListener listener)
        Tests if the sensor manager has a registration for the given listener.
      • hasListener

        public boolean hasListener​(SensorEventListener listener,
                                   Sensor sensor)
        Tests if the sensor manager has a registration for the given listener for the given sensor.
      • getListeners

        public List<SensorEventListener> getListeners()
        Returns the list of SensorEventListeners registered on this SensorManager. Note that the list is unmodifiable, any attempt to modify it will throw an exception.
      • sendSensorEventToListeners

        public void sendSensorEventToListeners​(SensorEvent event)
        Propagates the event to all registered listeners.
      • createSensorEvent

        public SensorEvent createSensorEvent()
      • createSensorEvent

        public static SensorEvent createSensorEvent​(int valueArraySize)
        Creates a SensorEvent with the given value array size, which the caller should set based on the type of Sensor which is being emulated.

        Callers can then specify individual values for the event. For example, for a proximity event a caller may wish to specify the distance value:

        
         event.values[0] = distance;
         

        See SensorEvent.values for more information about values.

      • createSensorEvent

        public static SensorEvent createSensorEvent​(int valueArraySize,
                                                    int sensorType)
        Creates a SensorEvent for the given Sensor type with the given value array size, which the caller should set based on the type of sensor which is being emulated.

        Callers can then specify individual values for the event. For example, for a proximity event a caller may wish to specify the distance value:

        
         event.values[0] = distance;
         

        See SensorEvent.values for more information about values.