serbanghita / Mobile-Detect

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
http://mobiledetect.net
MIT License
10.52k stars 2.67k forks source link

Support for Japanese "Gala-kei" Legacy Mobile Phones #325

Closed johnnyshields closed 1 year ago

johnnyshields commented 9 years ago

In Japan, a large percentage (~50%) of mobile browsers are on legacy mobile phones which are only sold in the Japanese market. These are called "Gala-kei" (Galapagos Phones) as explained here: http://en.wikipedia.org/wiki/Gal%C3%A1pagos_syndrome

Gala-kei phones can access internet, but support a very limited subset of HTML and generally require a specialized app to interact with them; unlike smartphones they do not have a "modern browser".

It would be nice to be able to detect these as a distinct class "galakei" which is different than "(smart)phone" and "tablet". It's quite easy to detect these based on user agent, here's Ruby code which does so: https://github.com/mobalean/galakei/blob/21074d654eb68462c606fa211fb2d7e4f4973321/lib/galakei/request.rb

There would be three manufacturers of these, "docomo", "au", and "softbank".

Would you accept a pull request which adds support for these?

serbanghita commented 9 years ago

@johnnyshields nice! Thank you for the references and code. I need to research this first, even if the regex might look easy it could easily conflict with the rest. You can send a pull request and I will review it. I'm currently research this and will get back to this thread! :+1:

johnnyshields commented 9 years ago

The regexes are:

/^DoCoMo/ =~ user_agent
/^KDDI-/ =~ user_agent
/^(SoftBank|Vodafone)/ =~ user_agent

The only one here in use is Vodaphone which maps to GenericPhone, but I think for this case it's ok to detect it as both "phone" and "galakei" (Vodaphone Japan changed its name to Softbank years ago so they are now increasingly rare in Japan.)

Kenshino commented 9 years ago

SoftBank and DoCoMo regularly takes phones made by Sharp, NEC etc and brand it as their own. They are increasingly making more and more Android based phones. Probably need to double check if the User Agent for those Android phones are not altered.

johnnyshields commented 9 years ago

The logic I've given above used by an existing library for Galakei support (https://github.com/mobalean/galakei) written by guys are experts in it--their company brands itself as Galakei consultants. I'm pretty sure this will work as-is. I've tested a few Android phones from Docomo and AU and it looks like the user agent is NOT altered (i.e. says Android etc...) but it's not a rigorous test.

Kenshino commented 9 years ago

That should be sufficient enough :) I'll test it on a SoftBank Android phone later too :)