I'm having a problem debugging my application. In my app I need to decide if a user is on a mobile device or not base on the user agent string.
From the log info, at the beginning I saw the user agent is "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1", which should be Safari 11 on iOS 11. Then several minutes later the user agent info changed to "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1 Safari/605.1.15", which should be Safari 11.1 on macOS (High Sierra). From tealeaf I saw the user didn't change browser or device.
So my questions are:
Is it possible for the user agent string changing without changing browser and device? When?
For my case, why it happens?
What's the most robust way to decide if a user is on mobile/tablet or desktop?
thanks.