I want to start another application from my application with the help of an implicit intent and want the second activity to get stoped after a perticular interval of time.
For eg: To open chrome i could do it like
String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.setPackage("com.android.chrome");
try {
startActivity(i);
} catch (ActivityNotFoundException e) {
// Chrome is probably not installed
// Try with the default browser
i.setPackage(null);
startActivity(i);
}
But i want chrome to automatically get closed after 1 minute. Is there any way to do this?