You can set the sensor update rate (frequency) when you register the sensor listener. But is it possible to change it dynamically?
Here’s the problem: I want to get the readings from accelerometer on normal rate, but when the certain threshold is reached I want to have the readings as fast as possible. It can certainly be done with unregistering and then registering the listener again with new update parameter but if the threshold is reached very often, then it might become inefficient, I guess. Which is why I ask whether there is any way around.
No, it is not possible. What you could do is to subscribe to the readings at the fast rate but drop the unwanted events unless your threshold is reached. Since the rate at which you subscribe to the events is anyway just a hint to the system (the documentation says “Events may be received faster or slower than the specified rate. Usually events are received faster”) this could actually be a more robust and efficient approach than relying on the system update rate.