How to detect button press with blocking call.