I am trying to get my application to detect a mobile device and render that page but I am getting no response but my index.html page is rendering. It is completely ignoring my mobile controller.
@Controller
public class DeviceDetection {
@RequestMapping("/")
public @ResponseBody String detectDevice(Device device) {
if (device.isNormal()) {
System.out.println("Inside isNormal()");
return "index";
} else if (device.isMobile()) {
System.out.println("Inside isMobile()");
return "mobilePage";
} else if (device.isTablet()) {
return "mobilePage";
}
return "index";
}
}
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mobile</artifactId>
</dependency>