We have faced the same issue during our test script creation and resolved it successfully.
Initially when we create the script we used " driver.sendKeyEvent(66)" and even tried 84 for clicking on search button but it never worked.
Later after doing research we identified the below details,
In the application source when user tap on the search it is used "OnEditorActionListener" to identify the search key pressed and do action based on it, The function definition looks like below
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
{
-- the condition and the action written inside this--
}
Unfortunately the keyevent we are sending will not capture through this listener, So we have added another listener and method to handle that case along with OnEditorActionListener , that is "OnKeyListener" and the method definition looks like below
public boolean onKey(View v, int keyCode, KeyEvent event)
{
-- The condition to check for keycode 66 and 84 and if it is satisfied do the search action---
}
This will be used when we send the keyevent from the script and there is no impact on the manual search process.After this the search is working very fine without any issue.
Please note; we havent changed anything in our test script, only change made in the application soruce for search part.
You can check with your app developer to check this case.I hope this will help to resolve the issue.