If you are using appium 1.8, You can write the code similar to this :
HashMap<String, Object> args = new HashMap<>();
args.put(“bundleId”, X_BUNDLE_ID);
driver.executeScript(“mobile: launchApp”, args);
args.put(“bundleId”, BROWSER);
driver.executeScript(“mobile: activateApp”, args);