I’d like to execute a method 10 seconds after I launch an Intent:
Intent launchIntent = getPackageManager().getLaunchIntentForPackage(GOOGLE_VOICE_SEARCH_PACKAGE_NAME);
startActivity(launchIntent);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
SonrLog.d(TAG, "TIMEOUT, reconnecting!");
reconnectSONR();
}
}, 10000); //10 second timeout
The Intent launches, and my code steps over the Handler, but nothing gets printed or gets called.
How can I get this to work?
Well I tried the above code and it is working fine. And I can see the log
Log.d(TAG, "TIMEOUT, reconnecting!");printed in the log. Code that i used.NOTE: GOOGLE_VOICE_SEARCH_PACKAGE_NAME is pointed to some other package as it is just for testing.