 
	
You are here: Forum Home → ANT Developers Forums → ANT in Mobile Phones → Thread
I recently found out that the ANT method "setSearchTimeout()" doesn't let you set the searchTimeout to anything beyond the MAX, which is 25 seconds for low priority and 5 seconds for high priority. Specifically for my situation, I want to extend the searchTimeout to 10 minutes or ideally to set it to the screen display's timeout. Additionally, I am only using one ANT channel at all times, so low and high priority are of no significance to me.
I know I can set an arbitrary searchTimeout via the "setSearchTimeout()" method and have it retry an X amount of times in order to accomplish the 10 minute goal. I am just not sure where to put that logic or how to implement it. Any help is appreciated.
For reference, I am getting over it Java on a Samsung S4 Galaxy. Let me know if you have any coding ideas on how to extend the searchTimeout to 10 minutes.
Thanks
I recently found out that the ANT method "setSearchTimeout()" doesn't let you set the searchTimeout to anything beyond the MAX, which is 25 seconds for low priority and 5 seconds for high priority. Specifically for my situation, I want to extend the searchTimeout to 10 minutes or ideally to set it to the screen display's timeout. Additionally, I am only using one ANT channel at all times, so low and high priority are of no significance to me.
I know I can set an arbitrary searchTimeout via the "setSearchTimeout()" method and have it retry an X amount of times in order to accomplish the 10 minute goal. I am just not sure where to put that logic or how to implement it. Any help is appreciated.
For reference, I am using Java on a Samsung S4 Galaxy. Let me know if you have any coding ideas on how to extend the searchTimeout to 10 minutes.
Thanks
import com.dsi.ant.AntManager;
public class AntSearch {
    private static final int MAX_SEARCH_TIME = 5; // Max time for each search attempt
    private static final int SEARCH_RETRIES = 120; // Number of attempts (10 minutes)
    public void startAntSearch(AntManager antManager) {
        for (int i = 0; i < SEARCH_RETRIES; i++) {
            antManager.setSearchTimeout(MAX_SEARCH_TIME);
            antManager.startSearch();
            
            try {
                Thread.sleep(MAX_SEARCH_TIME * 1000); // Wait for 5 seconds
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (deviceFound()) {
                break; // Exit if the device is found
            }
        }
    }
    private boolean deviceFound() {
        // Check if the device has been found
        return false; // Modify as needed
    }
}