Android device info is not detected correctly
2.6.5 :001 > browser = Browser.new("Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36")
=> #<Browser::Chrome:0x000055f37d32fb38 @ua="Mozilla/5.0 (Linux; Android 7.1.2; Redmi 4X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36", @accept_language=[]>
2.6.5 :002 > browser.device.id
=> :unknown
2.6.5 :003 > browser.device.name
=> "Unknown"
2.6.5 :001 > browser = Browser.new "Mozilla/5.0 (Linux; Android 10; HMA-AL00; HMSCore 5.0.0.304; GMSCore 19.6.29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 HuaweiBrowser/10.1.2.300 Mobile Safari/537.36"
=> #<Browser::Chrome:0x00007f71f4345748 @ua="Mozilla/5.0 (Linux; Android 10; HMA-AL00; HMSCore 5.0.0.304; GMSCore 19.6.29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 HuaweiBrowser/10.1.2.300 Mobile Safari/537.36", @accept_language=[]>
2.6.5 :002 > browser.device.id
=> :unknown
2.6.5 :003 > browser.device.name
=> "Unknown"
2.6.5 :001 > browser = Browser.new "Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N960U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36"
=> #<Browser::SamsungBrowser:0x00007f71f5a6d9c0 @ua="Mozilla/5.0 (Linux; Android 10; SAMSUNG SM-N960U) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36", @accept_language=[]>
2.6.5 :002 > browser.device.id
=> :unknown
2.6.5 :003 > browser.device.name
=> "Unknown"
related to #232
https://github.com/fnando/browser/blob/29cdf93b1c18f5bc4f9b79ef62cd5b559cd7f0d6/lib/browser/device/android.rb#L3-L20
https://github.com/fnando/browser/blob/29cdf93b1c18f5bc4f9b79ef62cd5b559cd7f0d6/test/unit/device_test.rb#L242-L260
List of Android smartphones
https://en.wikipedia.org/wiki/List_of_Android_smartphones
With so many Android device manufacturers, we probably don't need to identify every model exactly. Maybe it's enough that we recognize it as Android!
It's really hard to detect device information from UA, except for Apple devices.
@itsalongstory Android UA is implemented thinking that it always contains build information. This is the cause of the issue. The UA you presented also does not contains build information
Contains build information
Mozilla/5.0 (Linux; Android 11; Pixel 5 Build/RQ2A.210305.006; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.86 Mobile Safari/537.36
Not contains build information
Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.105 Mobile Safari/537.36
There are actually UAs that don't include Build. Therefore, the current processing is incorrect.
https://github.com/fnando/browser/blob/29cdf93b1c18f5bc4f9b79ef62cd5b559cd7f0d6/lib/browser/device/android.rb#L10-L13
@fnando Ar we on the same page? If so, I will PR.