Skip to content

Instantly share code, notes, and snippets.

@chamithchathuka
Created September 19, 2020 06:21
Show Gist options
  • Select an option

  • Save chamithchathuka/a351f454efd9c45bea85d64ba1085daf to your computer and use it in GitHub Desktop.

Select an option

Save chamithchathuka/a351f454efd9c45bea85d64ba1085daf to your computer and use it in GitHub Desktop.
@RequestMapping("/socialshare")
void handleUpdate(HttpServletResponse response,@RequestHeader("User-Agent") String os) throws IOException {
System.out.println(os);
if (Pattern.compile(Pattern.quote("Android"), Pattern.CASE_INSENSITIVE).matcher(os).find())
response.sendRedirect("https://play.google.com/store/apps/details?id=com.rezgcorp.powerworld&hl=en");
else if (Pattern.compile(Pattern.quote("iPhone"), Pattern.CASE_INSENSITIVE).matcher(os).find()) {
response.sendRedirect("https://apps.apple.com/us/app/power-world-access-app/id1514909558");
} else {
response.sendRedirect("https://play.google.com/store/apps/details?id=com.rezgcorp.powerworld&hl=en");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment