Open ThorstenBux opened 6 years ago
Can you give examples of values for phone-type? And you might run the method against all the user-agents of the unit-tests. What about non-Android devices?
@ThorstenBux Mobile Detect library has the following KNOWN LIMITATIONS
The changes cannot be done to the script because of:
Mobile Detect script was designed to detect
mobile
devices. Implicitly other devices are considered to bedesktop
.
@hgoebl for example on Android I'd expect to get the phone type: Pixel or Nexus 6 or Galaxy S6. These values are part of the user-agent on Android and on iOS if one uses a WebKit browser. So I think it should be possible to return them.
@serbanghita I don't quite understand your point. If it is a mobile phone it has a type i.e. Galaxy S6 and that type would still make it a mobile device and not a desktop device.
@ThorstenBux ok now I really understand the problem you are trying to solve.
We are going to have a solution on the next major version of Mobile Detect. Take a look at an example of regexes that are being checked in a certain context to determine the model
or version
.
I'm going to backup what @hgoebl said, this is a good start but it's a huge task that cannot be achieved without writing tests on each step of detection.
I'm currently discussing with Google if they could provide us their device catalog including form-factor. They have a device catalog including all Android devices. One of the properties of such a record is form-factor (phone, tablet, tv, ...). Would be quite easy to create a single regular expression each for phone and for tablet and nobody would have to maintain the regular expressions manually. Currently, I don't know whether we get the list from Google.
@ThorstenBux for which case do you need the phoneType? Just for information or in the detection logic?
@hgoebl @serbanghita thanks for your positive response :). Unfortunately, regular expressions are one of my weak spots but if you could point me in the right direction I'm happy to support where I can. If it is only testing that would be fine as well.
I'd need the phoneType mainly for information. I'm involved in the artoolkitX (https://github.com/artoolkitx/artoolkit5) project and we maintain a server with camera calibrations for a lot of Android, iOS devices and desktop (WebCam) devices. So far we only dealt with native apps on Android and iOS which made it easy to look up the phoneType and uniquely identify a specific phone series. Now we expand into the support of augmented reality (AR) inside the browser using jsARToolKit and we would like to integrate the camera calibration service into the jsARToolKit as well. For that, I'm looking for some possibility to get as much information about the device as possible from inside the browser. mobile-detect.js is a good start to get things moving but as said I'd need the phoneType to look-up a decent camera calibration for the specific phone. (What many don't know, because it is mostly taken care of in the background, without a decent calibration AR loses some of its magic ;-) .)
@ThorstenBux thank you for sharing your use-case! This actually motivates me to go forward with the deviceType
detection. I cannot make any promises at the moment, I'm working towards this goal and currently I'm writing tests and researching.
@serbanghita sounds good. I've done some research so far and it looks like there is nothing we can do if the client is a Firefox on mobile because the userAgent doesn't hold much information. Here are the userAgents I collected so far
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36
Chrome on mobile:
Mozilla/5.0 (Linux; Android 7.0; HTC 10 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.111 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/M4B30Z) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36
Firefox on mobile:
Mozilla/5.0 (Android 7.0; Mobile; rv:57.0) Gecko/57.0 Firefox/57.0
iPhone 6s Safari:
Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0 Mobile/15B202 Safari/604.1
From that it looks like we need to focus on WebKit browsers. Let me know if/how I can support you.
Cheers
@ThorstenBux btw, I looked over the projects on GitHub and the closest I found to what you need is https://github.com/piwik/device-detector - written in PHP.
@hgoebl @serbanghita is that the list you are looking for? https://support.google.com/googleplay/answer/1727131?hl=en
Also available as google doc https://docs.google.com/spreadsheets/u/1/d/16gXm7mGsXY_wQjTsRJYQVKkIjR8c3v-MAliAiRs0E3c/pub?gid=0&single=true
(thanks to @philip-lamb for the links)
Yes @ThorstenBux this is the list. But Google has much more columns and unfortunately only exposes those few fields. We need the form-factor (tablet, phone). With this additional column, we could generate regular expressions targeting all devices with Android. Imagine that!
Hi, I need to get the actual phone Type not only the manufacturer or vendor from the userAgent string. As it looks the type is available on WebKit phones on AndroidOS. I don't have many Android phones to test (only three) but it works on those. Also, the algorithm might not be sufficient for all cases.
I'd like to get some feedback on this proposed feature (function) for mobile-detect.js. I'm happy to adapt the code or follow another path, just let me know.
Thanks