• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
  • Fill out your device list and let everyone know which phones you have!    Edit Your Device Inventory

Sharing JavaScript Code That Helps Identify HMS Devices

Search This thread

Martin Bieber

Senior Member
Jul 23, 2020
247
32
Huawei browser provides below UAs(User Agents) data, based on whether the device is the HMS or GMS. The following are four cases (Note : browser version, HMS version, GMS version, and device information will change accordingly):

1. If both the HMS and GMS are installed, the following information is displayed:

Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00; HMSCore/4.0.0 GMS/10.4)

AppleWebKit/537.36 (KHTML, like Gecko)

Chrome/70.0.3538.64

HuaweiBrowser/10.0.3.102

Mobile Safari/537.36

2. If only the HMS is installed, the following information is displayed:

Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00; HMSCore/4.0.0)

AppleWebKit/537.36 (KHTML, like Gecko)

Chrome/70.0.3538.64

HuaweiBrowser/10.0.3.102

Mobile Safari/537.36

3. If only the GMS is installed, the command output is as follows:

Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00; GMS/10.4)

AppleWebKit/537.36 (KHTML, like Gecko)

Chrome/70.0.3538.64

HuaweiBrowser/10.0.3.102

Mobile Safari/537.36

4. If there is no HMS or GMS, the following information is displayed:

Mozilla/5.0 (Linux; Android 6.0.1; LYA-AL00)

AppleWebKit/537.36 (KHTML, like Gecko)

Chrome/70.0.3538.64

HuaweiBrowser/10.0.3.102

Mobile Safari/537.36

Get above values using navigator.userAgent

For details about Huawei developers and HMS, visit the website.
https://forums.developer.huawei.com/forumPortal/en/home?fid=0101246461018590361
 
Last edited: