(EXTERNAL) Solution Introduction of Google Warning Issue (For Friendly CP...
(EXTERNAL) Solution Introduction of Google Warning Issue (For Friendly CP...
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 1
AGENDA
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 2
Solutions of Google Warning Issue
Solution 1 (recommended) : Upgrade the HMS Core SDK in app to the latest version.
• Workload evaluation : the estimated workload for version update and error code adaptation is 2 to 3 person-days. The estimated code volume is about
100 lines (may vary as using different integrations and error code adaptation methods ) . The verification workload is estimated to be 2 to 3 person-
days.
APP
APP Update to the latest Repackage and release
HMS SDK version. (Mixed package of GMS and latest to Google Play
(GMS and HMS hybrid package)
HMS)
Solution 2 : Split developer app into two separate packages, released on Huawei App Gallery and Google Play separately.
• Workload evaluation : the estimated workload for project splitting and code deletion is 3 person-days, and the code volume is estimated to be about
200 lines.(may vary as the number of integrated HMS Core SDKs and code complexity). The verification workload is estimated to be 2 person-days.
• Due to project split, new functions need to be developed in GMS project and HMS project respectively.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 3
AGENDA
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 4
Solution 1 (recommended): Upgrade the HMS Core SDK in app to
the latest version
Step 1 : Based on the development language or platform you use, Select an upgrade solution to update to the latest version:
Java Project Upgrade (E.g. : Android Studio)
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 5
Step 1 -- Java Project Upgrade (E.g. : Android Studio)
1. Check whether the HMS Core SDK listed in the following excel list are used in the app/build.gradle file. If yes, update to the latest HMS Core SDK version in
the list. For example:
HMS Core SDK
List
2. Synchronize projects in Android Studio, the system automatically downloads the SDK of the new version.
3. Add the processing of the error "The HMS Core is not installed on the device". When getting the error code
USER_ALREADY_KNOWS_SERVICE_UNAVAILABLE, CURRENT_SHOWING_SERVICE_UNAVAILABLE or CLIENT_API_INVALID, you can invoke the GMS interface
or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
public void silentSignIn() {
AccountAuthParams mAuthParam =
new AccountAuthParamsHelper(AccountAuthParams.DEFAULT_AUTH_REQUEST_PARAM).setAccessToken().createParams();
AccountAuthService mAuthManager = AccountAuthManager.getService(mActivity, mAuthParam);
Task<AuthAccount> taskSilentSignIn = mAuthManager.silentSignIn();
taskSilentSignIn.addOnSuccessListener(this::loginComplete);
taskSilentSignIn.addOnFailureListener(e -> {
if (e instanceof ApiException) {
ApiException apiException = (ApiException) e;
if((apiException.getStatusCode() == AvailableCode.USER_ALREADY_KNOWS_SERVICE_UNAVAILABLE)
||(apiException.getStatusCode() == AvailableCode.CURRENT_SHOWING_SERVICE_UNAVAILABLE)
||(apiException.getStatusCode() == CommonCode.ErrorCode.CLIENT_API_INVALID)) {
gmsAcctLogin(); // Call GMS Interface
}
}
});
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 6
Step 1 -- Java Project Upgrade (E.g. : Android
Studio)
• Directly skip when the HMS Core APK is not installed :
private void signInCode() {
AccountAuthParams mAuthParam = new
AccountAuthParamsHelper(AccountAuthParams.DEFAULT_AUTH_REQUEST_PARAM)
.setProfile()
.setAuthorizationCode()
.createParams();
AccountAuthService mAuthManager = AccountAuthManager.getService(this, mAuthParam);
startActivityForResult(mAuthManager.getSignInIntent(), REQUEST_SIGN_IN_LOGIN_CODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_SIGN_IN_LOGIN) {
Task<AuthAccount> authAccountTask = AccountAuthManager.parseAuthResultFromIntent(data);
if (authAccountTask.isSuccessful()) {
// Success Processing
} else {
int errCode = ((ApiException) authAccountTask.getException()).getStatusCode();
if ((errCode == AvailableCode.USER_ALREADY_KNOWS_SERVICE_UNAVAILABLE)
|| (errCode == AvailableCode.CURRENT_SHOWING_SERVICE_UNAVAILABLE)
|| (errCode == CommonCode.ErrorCode.CLIENT_API_INVALID)) {
// There is no HMS Core APK on the phone, no need to handle.
} else {
Log.i(TAG, "signIn failed: " + ((ApiException) authAccountTask.getException()).getStatusCode());
}
}
}
}
4. Delete the following metadata configuration from the AndroidManifest.xml file. (Skip this step if it is not configured.)
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 7
Step 1 -- React Native project upgrade
1. Modify the HMS Core SDK version in the build.gradle file in the node_modules/@hmscore/react-native-hms-account/android directory (the Account Kit
plug-in is used as an example) :
Note: Check whether the HMS Core SDKs listed in the excel list are used in the application. If yes, update to the latest HMS Core SDK version.
2. Add the processing of the error "The HMS Core is not installed on the device". When getting the error code 30, 31 or 907135003, you can invoke the GMS
interface or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
silentSignIn = () => {
let silentSignInData = {
accountAuthParams: HMSAuthParamConstants.DEFAULT_AUTH_REQUEST_PARAM,
};
HMSAccountAuthService.silentSignIn(silentSignInData)
.then((response) => { this.logger(“silentSignIn -> ”, response) })
.catch((err) => { this.errorLogger("silentSignIn -> ", err);
if (err.code == 30 || err.code == 31 || err.code == 907135003) {
gmsSignIn(); // Call GMS Interface
}
});
};
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 8
Step 1 -- React Native project upgrade
• Directly skip when the HMS Core APK is not installed :
signInWithIdToken = () => {
let signInData = {
accountAuthParams: HMSAuthParamConstants.DEFAULT_AUTH_REQUEST_PARAM,
authRequestOption: [HMSAuthRequestOptionConstants.ID_TOKEN,
HMSAuthRequestOptionConstants.ACCESS_TOKEN, HMSAuthRequestOptionConstants.CARRIERID],
authScopeList: [HMSAuthScopeListConstants.EMAIL]
};
HMSAccountAuthService.signIn(signInData)
.then((response) => { this.logger("Sign In With IdToken1 -> ", response) })
.catch((err) => { this.errorLogger("Sign In With IdToken2 -> ", err);
if(err.code == 30 || err.code == 31 || err.code == 907135003) {
// No need to handle HMS error
}});
};
3. After the update, re-compile the project ,then the plug-in will download the new SDK.
react-native run-android
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 9
Step 1 -- Cordova Project Upgrade
1. Modify the HMS Core SDK version in the plugin.xml file in the node_modules/@hmscore/cordova-plugin-hms-account directory (the Account Kit plug-in is used as an
example) :
HMS Core SDK
List
Note: Check whether the HMS Core SDKs listed in the excel list are used in the application. If yes, update to the latest HMS Core SDK version.
2. Delete the platforms/android and plugins/cordova-plugin-hms-account directories from the root directory.
3. Add the processing of the error “The HMS Core is not installed on the device”. When getting the error code 30, 31 or 907135003, you can invoke the GMS interface
or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
async function accountSilentSignIn() {
try {
const authParam = HMSCommonTypes.AuthParams.DEFAULT_AUTH_REQUEST_PARAM;
const packageName = HMSCommonTypes.PackageName.ACCOUNT;
const res = await HMSAccountAuthService.silentSignIn(authParam,packageName);
alert("silentSignIn -> success :" + JSON.stringify(res));
} catch (ex) {
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 ||ex['errorCode'] == 907135003) {
gmsLogin(); // Call GMS Interface
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 10
Step 1 -- Cordova Project Upgrade
• Directly skip when the HMS Core APK is not installed :
async function accountSignInWithIdToken() {
const signInParameters = {
authRequestOption: [HMSCommonTypes.AuthRequestOption.SCOPE_ID_TOKEN,
HMSCommonTypes.AuthRequestOption.SCOPE_ACCESS_TOKEN,HMSCommonTypes.AuthRequestOption.SCOPE_CARRIER
_ID],
authParam: HMSCommonTypes.AuthParams.DEFAULT_AUTH_REQUEST_PARAM,
authIdTokenSignAlg: HMSCommonTypes.AuthIdTokenSignAlg.PS256
}
const packageName = HMSCommonTypes.PackageName.ACCOUNT;
try {
const res = await HMSAccountAuthService.signIn(signInParameters,packageName);
accessToken = res.accessToken;
alert(JSON.stringify(res));
} catch (ex) {
alert(JSON.stringify(ex));
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 ||ex['errorCode'] == 907135003) {
// No need to handle HMS error
}
}
}
4. Run the following command in the root directory to recompile the project:
cordova platform add android
cordova run android --device
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 11
Step 1 -- Ionic-Cordova Project Upgrade
1. Modify the HMS Core SDK version in the plugin.xml file in the node_modules/@hmscore/cordova-plugin-hms-account directory (the Account Kit plug-in is used as
an example) :
HMS Core SDK
List
Note: Check whether the HMS Core SDKs listed in the excel list are used in the application. If yes, update to the latest HMS Core SDK version.
2. Delete the platforms/android and plugins/cordova-plugin-hms-account directories from the root directory.
3. Add the processing of the error "The HMS Core is not installed on the device". When getting the error code 30, 31 or 907135003, you can invoke the GMS
interface or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
async silentSignIn() {
console.log('silentSignIn clicked!');
const huaweiIdAuthParam: AuthParams = AuthParams.DEFAULT_AUTH_REQUEST_PARAM;
const packageName = PackageName.HWID;
try {
const res = await this.account.silentSignIn(huaweiIdAuthParam,packageName);
console.log(JSON.stringify(res));
alert('silentSignIn -> success :' + JSON.stringify(res));
} catch (ex) {
alert('silentSignIn -> Error : ' + JSON.stringify(ex));
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 || ex['errorCode'] == 907135003) {
gmsLogin(); // Call GMS Interface
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 12
Step 1 -- Ionic-Cordova Project Upgrade
• Directly skip when the HMS Core APK is not installed :
async signInWithIdToken() {
console.log('signInWithIdToken clicked!');
const signInParam: SignInData = {
"authRequestOption": [AuthRequestOption.SCOPE_ID_TOKEN],
"authParam": AuthParams.DEFAULT_AUTH_REQUEST_PARAM,
"authScopeList": [AuthScopeList.EMAIL, AuthScopeList.PROFILE]
}
const packageName = PackageName.HWID;
try {
const res = await this.account.signIn(signInParam,packageName);
console.log(JSON.stringify(res));
alert('signIn -> success' + JSON.stringify(res));
} catch (ex) {
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 || ex['errorCode'] == 907135003) {
// No need to handle HMS error
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 13
Step 1 -- Ionic-Capacitor Project Upgrade
1. Modify the HMS Core SDK version in the plugin.xml file in the node_modules/@hmscore/cordova-plugin-hms-account directory (the Account Kit plug-in is used as
an example) :
HMS Core SDK
List
Note: Check whether the HMS Core SDKs listed in the excel list are used in the application. If yes, update to the latest HMS Core SDK version.
3. Add the processing of the error "The HMS Core is not installed on the device". When getting the error code 30, 31 or 907135003, you can invoke the GMS
interface or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
async silentSignIn() {
console.log('silentSignIn clicked!');
const huaweiIdAuthParam: AuthParams = AuthParams.DEFAULT_AUTH_REQUEST_PARAM;
const packageName = PackageName.HWID;
try {
const res = await this.account.silentSignIn(huaweiIdAuthParam,packageName);
console.log(JSON.stringify(res));
alert('silentSignIn -> success :' + JSON.stringify(res));
} catch (ex) {
alert('silentSignIn -> Error : ' + JSON.stringify(ex));
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 || ex['errorCode'] == 907135003) {
gmsLogin(); // Call GMS Interface
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 14
Step 1 -- Ionic-Capacitor Project Upgrade
• Directly skip when the HMS Core APK is not installed :
async signInWithIdToken() {
console.log('signInWithIdToken clicked!');
const signInParam: SignInData = {
"authRequestOption": [AuthRequestOption.SCOPE_ID_TOKEN],
"authParam": AuthParams.DEFAULT_AUTH_REQUEST_PARAM,
"authScopeList": [AuthScopeList.EMAIL, AuthScopeList.PROFILE]
}
const packageName = PackageName.HWID;
try {
const res = await this.account.signIn(signInParam,packageName);
console.log(JSON.stringify(res));
alert('signIn -> success' + JSON.stringify(res));
} catch (ex) {
if(ex['errorCode'] == 30 || ex['errorCode'] == 31 || ex['errorCode'] == 907135003) {
// No need to handle HMS error
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 15
Step 1 -- Flutter Project Upgrade
1. Find the plug-in directory in the pubspec.xml file (Account Kit is used as an example):
• If the plugin information is displayed like below, the HMS Core plug-in is in the Flutter cache directory:
• If the plugin information is displayed like below, the HMS Core plug-in is in the directory where library_path is located:
2. In the android/build.gradle file in the plug-in directory, modify the HMS Core SDK version (Account Kit is used as an example):
Note: Check whether the HMS Core plug-in in pubspec.xml is in the excel list one by one. If yes, update to the latest HMS Core SDK version.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 16
Step 1 -- Flutter Project Upgrade
3. Add the processing of the error "The HMS Core is not installed on the device". When getting the error code 30, 31 or 907135003, you can invoke the GMS interface
or directly skip based on app service logic:
• Invoke the GMS interface when the HMS Core APK is not installed :
_silentSignIn() async {
try {
final AuthAccount account = await AccountAuthService.silentSignIn();
_addToLogs("FROM SILENT SIGN IN: " + account.displayName!);
} on Exception catch (e) {
_addToLogs(e.toString());
if (e is PlatformException && (e.details == 30 || e.details == 31 || e.details ==
907135003)) {
gmsLogin();
}
}
}
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 17
Step 2 -- Application Verification & Test
After the modification and upgrade, two verification & test methods are suggested :
Method 1 : Print project dependencies and check whether the modified HMS Core SDK version has been upgraded to the new version(refer to HMS
Core SDK List.xls). Reference command : gradlew -q:app:dependencies :
Method 2: Verify & test the application running status on a non-Huawei phone.
1. On a non-Huawei mobile phone, access the application management page and uninstall the HMS Core APK. (Skip this step if not installed).
2. Run the application to be tested on the phone, use functions related to the HMS Core, and check the running status :
a) No error is reported. Purpose : Check whether the error code "The HMS Core is not installed" is adapted in the application.
b) When the HMS Core SDK interface is invoked, the message “The HMS Core is not installed” is displayed. (Only some Kits will display this message.)
For details about the pop-up kit, see the following excel list . The pop-up prompt is like the figure on the right :
Popup List
c) The HMS Core APK download and installation are not triggered.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 18
Step 3 -- Compile & Release
Recompile the modified project, and publish the compiled version to Google Play.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 19
AGENDA
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 20
Solution 2 : Split developer app into two separate packages,
released on Huawei App Gallery and Google Play separately
Step 1 : Split the application project into an independent project for Google Play, and delete the HMS Core SDK content from the project.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 21
Step 1 -- Split the application project into an independent project for
Google Play, and delete the HMS Core SDK content from the project
1. Copy the current app project into a separate Google Play project.
2.2 Delete the agcp plug-in configuration from the build.gradle file.
2.3 Delete the AGC plug-in configuration from the build.gradle file at the application level.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 22
Step 1 -- Split the application project into an independent project for
Google Play, and delete the HMS Core SDK content from the project
2.4 Delete the HMS SDK dependency from the build.gradle file at the application level.
2.6 If metadata in the following list is configured in the AndroidManifest.xml file, delete it:
MetaData-Remo
ve
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 23
Step 1 -- Split the application project into an independent project
for Google Play, and delete the HMS Core SDK content from the
project
2.7 Delete references to HMS Core SDK in code, for example:
2.8 Deleted the invoking of the HMS Core API in the code and updating the processing logic.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 24
Step 2 -- Application Verification & Test
Verification & test method : Verify the running status of the application on a non-Huawei phone :
1. On a non-Huawei mobile phone, access the application management page and uninstall the HMS Core APK. (Skip this step
if not installed).
2. Run the application to be tested on the phone, use functions related to the HMS Core, and check the running status :
a) No error is reported.
b) The HMS Core APK download and installation are not triggered.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 25
Step 3 -- Compile & Release
Recompile the modified Google app project , and release the compiled version to Google Play.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 26
AGENDA
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 27
Communication Channels & Suggestions with Google
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 28
AGENDA
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 29
FAQ
Q: Why do I need to upgrade to the latest HMS Core SDK?
A: The latest HMS Core SDK is optimized to ensure that the application which integrate the HMS Core SDK and released on Google Play complies with the
Device & Network Abuse Policy, which resolves the issue in Google warning mail.
Q: Does each Kit SDK used in the app need to be updated to the latest version?
A: We provide a list of kits that need to be updated to the latest SDK version. Kits in the list(HMS Core SDK List.xls) need to be updated to the latest SDK version.
A: Solution 1 (Integrating the latest HMS SDK) is recommended. This solution is easy to modify, requires a small workload, and less maintenance cost in future.
A : You can add the following configuration in app/build.gradle and make compile again:
packagingOptions { pickFirst 'core.properties' }
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 30
FAQ
Q: HMS Core APK 3.x has been installed on the phone, why I still receive error code USER_ALREADY_KNOWS_SERVICE_UNAVAILABLE (Value: 30)?
A: HMS Core APK 3.x doesn’t support auto-update. When HMS Core SDK find it is HMS Core APK 3.x, system will process in the same way as “HMS Core APK
doesn’t exist”, which will return error code USER_ALREADY_KNOWS_SERVICE_UNAVAILABLE(Value: 30) .
Q: On a mobile phone with HMS Core APK of an earlier version installed, why I still get the HMS Core upgrade popup even I have upgrade the HMS Core SDK
as requested?
A: When there is earlier version (but later than 4.0.0.300) of HMS Core APK installed, if HMS Core interface is invoked, HMS Core APK may start the upgrade. This
upgrade is triggered by HMS Core APK instead of the developer’s application.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 31
FAQ
Q: Do I need to update Ads SDK?
A: Ads Lite SDK will not trigger the HMS Core APK download. If you integrate Ads Lite SDK, it is not needed to update SDK. However Ads Full SDK will trigger
application download. If you integrate Ads Full SDK, the SDK update is necessary. The new version of Ads full SDK is in preparation, which will be released soon.
If you integrate the SDK through com.huawei.hms:ads-lite:x.x.x.x, the Ads Lite SDK is integrated.
If you integrate the SDK through com.huawei.hms:ads:x.x.x.x, the Ads Full SDK is integrated.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR HUAWEI Confidential Page 32
Thank you.
HUAWEI TECHNOLOGIES
HISILICON CO., LTD.
SEMICONDUCTOR Page 33