Sharing JavaScript Code That Helps Identify HMS Devices - Huawei Developers

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

Related

[Request] UA Strings from Custom ROM's

Hope this is the right place to post this, but I wanted to know if I could get people to post their UI Strings from Various ROM's for a Web Development project I am working on.
Need:
Device:
Carrier:
ROM Name and Version:
UA String:
To get your UA String, just use your device and browse to: http://whatsmyuseragent.com/
You will see your User Agent at the top of the page, Copy/Paste that if you can.
Any help would be appreciated.
Mine:
Device: Nexus One (T-Mobile)
Carrier: T-Mobile
ROM Name and Version: Eclair 2.1-update1 Build ERE27
UA String: Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Nexus One Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17
Mines the default for CM506, there is an option to modify it.
HTTP_USER_AGENT:Mozilla/5.0 (Linux Android 2.1-update1; en-us; Nexus O EPE54B) AppleWebKit/530.17 (KHTML Gecko) Version/4.0 Mobile Safari/530. HTTP_X_VIA:Harmony proxy
Opera/9.80 (12ME/MIDp; Opera Mini/5.0.18302/812; U; en) Presto/2.4.15
britoso said:
Mines the default for CM506, there is an option to modify it.
HTTP_USER_AGENT:Mozilla/5.0 (Linux Android 2.1-update1; en-us; Nexus O EPE54B) AppleWebKit/530.17 (KHTML Gecko) Version/4.0 Mobile Safari/530. HTTP_X_VIA:Harmony proxy
Click to expand...
Click to collapse
In the option to edit it, would it allow you to put in the stock UA String and be identified as that?
Talderon said:
In the option to edit it, would it allow you to put in the stock UA String and be identified as that?
Click to expand...
Click to collapse
Cant easily edit it, It has four options: Android,Desktop,iPhone,IE6

[Q] Custom Browser User Agent string

Hi,
I've been trying to change Streak's stock browser's default UA (as I know a lot of people have been trying for a while). I went and pulled Browser.apk from the /system/app and extracted the files inside.
(/system/app/Browser.apk/classes.dex)
I then went through each of the files and found the following in classes.dex:
At data offset:
0x00030DD1 to 0x00030E4A
Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16
and
0x00030E4D to 0x00030EDA
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17
These are the exact same UA strings I get when I switch to the Iphone and Desktop user agent through about:debug in the browser.
I assume changing these strings will change the UA of the respective settings under about:debug settings mode in the default browser. However, I haven't tried as the actual ua string I am looking for is the default.
The default user agent string on my Dell Streak is:
Mozilla/5.0 (Linux; U; Android 2.2; en-gb; Dell Streak Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
(currently using DJ_Steve's 1.4.6 Froyo rom)
Ultimately, I have these few questions, and am hoping someone out there can help:
1. I can't seem to find it in the Browser.apk, and am just wondering if it is a shared UA in webview for all the different network accessing applications?
2. If I change the default UA, would it affect all applications that uses the network?
3. Where is the default UA string kept?
4. For the about:debug method of changing the user agent string, is there a way to force the settings to persist after exit and restart of the browser application?
I apologize if I sound like I don't know what I am talking about, as this is my first android device, and my knowledge of linux/computers is generally quite limited.
Thanks ahead of time to anyone who can help out.

HUAWEI MOBILE CLOUD Service - Cloud Storage Upgrade Purchase Guide

Original link: https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201309395572810143&fid=0101187876626530001
When using the HMS Drive Kit, if the user's cloud storage is insufficient, the developer can determine whether the user has installed the HUAWEI MOBILE CLOUD app on the mobile phone through PackageManager.
If the app has been installed, the developer can invoke the upgrade purchase page of the Huawei MOBILE Cloud app in intent mode.
There is advised developer to use the dialog pop-up mode, which can allow users to determine whether to invoke the intent to access the HUAWEI MOBILE CLOUD upgrade page.
The core code for determining whether the HUAWEI MOBILE CLOUD app has been installed is as follows:
Code:
final PackageManager packageManager = activity.getPackageManager();
// Obtaining the Package Information of All Installed Programs
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
for (PackageInfo info : pinfo) {
if (info.packageName.equals("com.huawei.hidisk")) {
// Here is used to process the logic of the Huawei Mobile Cloud app that has been installed.
}
}
The core code for invoking the upgrade purchase page of the Huawei Mobile Cloud app is as follows:
Code:
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("hicloud://cloudDrive/getInfo?path=PackageInfoActivity"));
startActivity(intent);
For more details, you can go to:
Official website
Development Documentation page, to find the documents you need
Reddit to join our developer discussion
GitHub to download demos and sample codes
Stack Overflow to solve any integration problems

HMS Core SDK Version Updates

Dear developer,
HMS Core SDKs have undergone some version updates recently. To further improve user experience, update the HMS Core SDK integrated into your app to the latest version.
HMS Core SDK​Version​Link​Keyring​com.huawei.hms:keyring-credential:6.4.0.302​Link​Location Kit​com.huawei.hms:location:6.4.0.300​Link​Nearby Service​com.huawei.hms:nearby:6.4.0.300​Link​Contact Shield​com.huawei.hms:contactshield:6.4.0.300​Link​Video Kit​com.huawei.hms:videokit-player:1.0.12.300​Link​Wireless kit​com.huawei.hms:wireless:6.4.0.202​Link​FIDO​com.huawei.hms:fido-fido2:6.3.0.304
com.huawei.hms:fido-bioauthn:6.3.0.304
com.huawei.hms:fido-bioauthn-androidx:6.3.0.304​Link​Panorama Kit​com.huawei.hms: panorama:5.0.2.308​Link​Push Kit​com.huawei.hms: push:6.5.0.300​Link​Account Kit​com.huawei.hms:hwid:6.4.0.301​Link​Identity Kit​com.huawei.hms:identity:6.4.0.301​Link​Safety Detect​com.huawei.hms:safetydetect:6.4.0.301​Link​Health Kit​com.huawei.hms:health:6.5.0.300​Link​In-App Purchases​com.huawei.hms:iap:6.4.0.301​Link​ML Kit​com.huawei.hms:ml-computer-vision-ocr:3.6.0.300
com.huawei.hms:ml-computer-vision-cloud:3.5.0.301
com.huawei.hms:ml-computer-card-icr-cn:3.5.0.300
com.huawei.hms:ml-computer-card-icr-vn:3.5.0.300
com.huawei.hms:ml-computer-card-bcr:3.5.0.300
com.huawei.hms:ml-computer-vision-formrecognition:3.5.0.302
com.huawei.hms:ml-computer-translate:3.6.0.312
com.huawei.hms:ml-computer-language-detection:3.6.0.312
com.huawei.hms:ml-computer-voice-asr:3.5.0.301
com.huawei.hms:ml-computer-voice-tts:3.6.0.300
com.huawei.hms:ml-computer-voice-aft:3.5.0.300
com.huawei.hms:ml-computer-voice-realtimetranscription:3.5.0.303
com.huawei.hms:ml-speech-semantics-sounddect-sdk:3.5.0.302
com.huawei.hms:ml-computer-vision-classification:3.5.0.302
com.huawei.hms:ml-computer-vision-object:3.5.0.307
com.huawei.hms:ml-computer-vision-segmentation:3.5.0.303
com.huawei.hms:ml-computer-vision-imagesuperresolution:3.5.0.301
com.huawei.hms:ml-computer-vision-documentskew:3.5.0.301
com.huawei.hms:ml-computer-vision-textimagesuperresolution:3.5.0.300
com.huawei.hms:ml-computer-vision-scenedetection:3.6.0.300
com.huawei.hms:ml-computer-vision-face:3.5.0.302
com.huawei.hms:ml-computer-vision-skeleton:3.5.0.300
com.huawei.hms:ml-computer-vision-livenessdetection:3.6.0.300
com.huawei.hms:ml-computer-vision-interactive-livenessdetection:3.6.0.301
com.huawei.hms:ml-computer-vision-handkeypoint:3.5.0.301
com.huawei.hms:ml-computer-vision-faceverify:3.6.0.301
com.huawei.hms:ml-nlp-textembedding:3.5.0.300
com.huawei.hms:ml-computer-ner:3.5.0.301
com.huawei.hms:ml-computer-model-executor:3.5.0.301​Link​Analytics Kit​com.huawei.hms:hianalytics:6.5.0.300​Link​Dynamic Tag Manager​com.huawei.hms:dtm-api:6.5.0.300​Link​Site Kit​com.huawei.hms:site:6.4.0.304​Link​HEM Kit​com.huawei.hms:hemsdk:1.0.4.303​Link​Map Kit​com.huawei.hms:maps:6.5.0.301​Link​Wallet Kit​com.huawei.hms:wallet:4.0.5.300​Link​Awareness Kit​com.huawei.hms:awareness:3.1.0.302​Link​Crash​com.huawei.agconnect:agconnect-crash:1.7.0.300​Link​APM​com.huawei.agconnect:agconnect-apms:1.5.2.310​Link​Ads Kit​com.huawei.hms:ads-prime:3.4.55.300​Link​Paid Apps​com.huawei.hms:drm:2.5.8.301​Link​Base​com.huawei.hms:base:6.4.0.303​​
Required versions for cross-platform app development:
Platform: React Native
Plugin Name​Version​Link​react-native-hms-analytics​6.3.2-301​Link​react-native-hms-iap​6.4.0-301​Link​react-native-hms-location​6.4.0-300​Link​react-native-hms-map​6.3.1-304​Link​react-native-hms-push​6.3.0-304​Link​react-native-hms-site​6.4.0-300​Link​react-native-hms-nearby​6.2.0-301​Link​react-native-hms-account​6.4.0-301​Link​react-native-hms-ads​13.4.54-300​Link​react-native-hms-adsprime​13.4.54-300​Link​react-native-hms-availability​6.4.0-303​Link​
Platform: Cordova (Ionic-Cordova Ionic-Capacitor)
Plugin NameVersionLinkcordova-plugin-hms-analytics
ionic-native-hms-analytics​6.3.2-301​Link​cordova-plugin-hms-location
ionic-native-hms-location​6.4.0-300​Link​cordova-plugin-hms-nearby
ionic-native-hms-nearby​6.2.0-301​Link​cordova-plugin-hms-account
ionic-native-hms-account​6.4.0-301​Link​cordova-plugin-hms-push
ionic-native-hms-push​6.3.0-304​Link​cordova-plugin-hms-site
ionic-native-hms-site​6.4.0-300​Link​cordova-plugin-hms-iap
ionic-native-hms-iap​6.4.0-301​Link​cordova-plugin-hms-availability
ionic-native-hms-availability​6.4.0-303​Link​cordova-plugin-hms-ads
ionic-native-hms-ads​13.4.54-300​Link​cordova-plugin-hms-adsprime
ionic-native-hms-adsprime​13.4.54-300​Link​cordova-plugin-hms-map
ionic-native-hms-map​6.0.1-305​Link​cordova-plugin-hms-ml
ionic-native-hms-ml​2.0.5-303​Link​
Platform: Flutter
huawei_safetydetect​6.4.0+301​Link​huawei_iap​6.2.0+301​Link​huawei_health​6.3.0+302​Link​huawei_fido​6.3.0+304​Link​huawei_push​6.3.0+304​Link​huawei_account​6.4.0+301​Link​huawei_ads​13.4.55+300​Link​huawei_analytics​6.5.0+300​Link​huawei_map​6.5.0+301​Link​huawei_hmsavailability​6.4.0+303​Link​huawei_location​6.0.0+303​Link​huawei_adsprime​13.4.55+300​Link​huawei_ml​3.2.0+301​Link​huawei_site​6.0.1+304​Link​
Platform: Xamarin
Huawei.Hms.Hianalytics​6.4.1.302​Link​Huawei.Hms.Location​6.4.0.300​Link​Huawei.Hms.Nearby​6.2.0.301​Link​Huawei.Hms.Push​6.3.0.304​Link​Huawei.Hms.Site​6.4.0.300​Link​Huawei.Hms.Fido​6.3.0.304​Link​Huawei.Hms.Iap​6.4.0.301​Link​Huawei.Hms.Hwid​6.4.0.301​Link​Huawei.Hms.Ads-prime​3.4.54.302​Link​Huawei.Hms.Ads​3.4.54.302​Link​Huawei.Hms.Maps​6.5.0.301​Link​
If you have any further questions or encounter any issues integrating any of these kits, please feel free to contact us.
Region​Email​Europe​[email protected]​Asia Pacific​[email protected]​Latin America​[email protected]​Middle East & Africa​[email protected]wei.com​Russia​[email protected]​

Change useragent of Webview engine

I have a somewhat strange problem and trying to describe it.
Currently I am on stock ROM 9.1.0.132
I am using Outlook and O365. When I log in to O365 account, the webview sends the useragent:
Browser: Mozilla/5.0 (Linux; Android 12; ANE-LX1 Build/HUAWEIANE-L21; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.105 Mobile Safari/537.36 PKeyAuth/1.0
If Android "9" or if HUAWEI is in the text of the useragent my company blocks the access.
Some time ago I was using an EMUI ROM greater than 9.1.0.132 and I was able to change the text entry "HUAWEIANE-L21" in one of the build.props
Android "9" I was able to change to "12" (ro.build.version.release=12).
In Stock ROM 9.1.0.132, unfortunately I can't find "HUAWEIANE-L21" in the biuld.props anymore and I don't remember how I changed it back then.
Can someone please look in the build.props in /system and /vendor at Stock ROM > 9.1.0.132
Or does anyone have a tip, where the webview takes the useragent information from.
I'm on Magisk root and i dont want to update > 9.1.0.132
I found the solution in Magisk Module MagiskHideProps. If this module installed, the default /system/build.props will ignored.
Set "ro.build.id" by MagiskHideProps command in terminal -> "props ro.build.id Samsung" (Usage: props NAME VALUE)
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf/blob/master/README.md
This will change the default "ro.build.id=HUAWEIANE-L21" to ""ro.build.id=Samsung"
Can check by "getprop | grep ro.build.id
UserAgent is changed now.

Categories

Resources