Want to restart Android application in a single Appium session without deleting/uninstalling it

@wreed But activate_app() does not launch the app if its already running. It will launch app if it does not find the given app running. I want to re launch the app at certain conditions irrespective its running or not.

Ok, so terminate_app and activate_app to restart the app does not work for you. Maybe no way then.

could you please tell me what is the name & version of the jar file you had used for this.

((AndroidDriver) driver).closeApp();

This solution by @Aleksei works for my issue of closing and reopening an application in a single appium session.

@Aleksei
Using Appium 2.4.1 (appium java-clinet 7.3.0) and apparently launchApp() is deprecated, so as per your advice added driver.activateApp(appPackage) but it is still calling launchApp() after activateApp. How to disable launchApp() ?
(attached log img)

Note: app is launching on emulator but not proceeding due to below

Calling AppiumDriver.launchApp() with args: [“44700446-0c88-4831-af6a-959e558b8e5a”]

[AndroidUiautomator2Driver@6294 (44700446)] Encountered internal error running command: UnsupportedOperationError: This API is not supported anymore.
Thanks

it is now:

((InteractsWithApps) driver).activateApp(appID);

where appID is App_Package (android) or Bundle_ID (ios).

Full code to restart app:

((InteractsWithApps) driver).terminateApp(appID);
((InteractsWithApps) driver).activateApp(appID);