4
votes

I am very worried because the Huawei personal contact me and they explained that new phones do not will have Play Services Installed(Old news). The app in the I work currently uses differents Google Services: play-services-ads,play-services-auth,firebase-messaging,firebase-analytics, Crashlytics, Google Sheets, Google Drive.

We used Google Sign-in to obtaining the GoogleAccountCredential for we call to the Drive/Sheets API:

                GoogleAccountCredential credential = GoogleAccountCredential
                        .usingOAuth2(HomeActivity.this,
                                //Collections.singleton(DriveScopes.DRIVE_FILE));
                                Collections.singleton(DriveScopes.DRIVE));

public static DriveServiceHelper initDriveService(GoogleAccountCredential mCredential) {
    if(mDriveService == null && mCredential != null){
        // servicio drive
        mDriveService = new Drive.Builder(
                AndroidHttp.newCompatibleTransport(),
                new GsonFactory(),
                mCredential)
                .setApplicationName(getString(R.string.app_name))
                .build();
    }
    if(mSheetsService == null && mCredential != null){
        // servicio sheets
        mSheetsService = new Sheets.Builder(
                AndroidHttp.newCompatibleTransport(),
                new GsonFactory(),
                mCredential)
                .setApplicationName(getString(R.string.app_name))
                .build();
    }
    //driveServiceHelper = new DriveServiceHelper(googleDriveService);
    return new DriveServiceHelper(mDriveService, mSheetsService, mCredential);
}

Which would be the alternatives for can use the APIS previously mentioned installed in the new Huawei devices(without Google Play Services) and obtaining the Credentials necessary?

1

1 Answers

0
votes

1. Your app has integrated GMS. As new Huawei phones are banned from using GMS, you app, if with GMS integrated, will be unable to run on new Huawei phones. If you want your app to run on these phones, integrate Huawei Mobile Services (HMS). If you want to use the drive service in your app, and also want your app to run on both Huawei phones and Google Android phones, you can integrate both Google Drive and HMS Drive kit. Then your app will use HMS Drive Kit on Huawei phones, while using Google Drive on Google Android phones.

In the list you provided, you use these GMS services:

  • play-services-ads
  • play-services-auth
  • firebase-messaging
  • firebase-analytics
  • Crashlytics
  • Google Drive

You can refer to the following Huawei mobile services:

  1. You can use this IDE plug-in called HMS Core Toolkit to help you analyze where GMS is used in your code. HMS Core Toolkit implements app creation, coding, conversion, debugging, test, and release.
  • The Convertor is a code conversion tool supporting Java and Kotlin projects. This tool can help you quickly convert the existing Android app code for calling third-party APIs into the app code integrated with the HMS Core.
  • HMS Core Toolkit does not support automatic download of the AppGallery Connect configuration file and will be planned in later versions.