端末のHMSバージョンは次のコードで取得できます。
public String getHmsVersion(Context context) {
String version = null;
try {
PackageManager packageManager = context.getPackageManager();
if (null != packageManager) {
PackageInfo packageInfo = packageManager.getPackageInfo("com.huawei.hwid", 0);
if (null != packageInfo) {
version = packageInfo.versionName;
}
}
} catch (PackageManager.NameNotFoundException exception) {
exception.printStackTrace();
}
return version;
}