我很担心,因为华为个人联系我,他们解释说新手机不会安装播放服务(旧消息)。我工作的应用程序目前使用不同的 Google 服务:play-services-ads、play-services-auth、firebase-messaging、firebase-analytics、Crashlytics、Google Sheets、Google Drive。
我们使用 Google 登录来获取 GoogleAccountCredential 以调用 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);
}
可以使用前面提到的安装在新华为设备(没有 Google Play 服务)中的 APIS 并获得必要的凭据的替代方案是什么?
最佳答案
1.您的应用已集成 GMS。由于新的华为手机被禁止使用 GMS,如果您的应用程序集成了 GMS,将无法在新的华为手机上运行。如果您希望您的应用在这些手机上运行,请集成华为移动服务 (HMS)。
如果你想在你的应用中使用驱动服务,并且希望你的应用同时运行在华为手机和谷歌安卓手机上,你可以集成谷歌驱动和HMS驱动套件。然后您的应用将在华为手机上使用 HMS Drive Kit,而在 Google Android 手机上使用 Google Drive。
在您提供的列表中,您使用以下 GMS 服务:
您可以引用以下华为移动服务:
关于android - 用于 Google APIS(驱动器和表格)的新华为设备(无 Google Play 服务)中 Google 登录的替代方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60177372/