小编Day*_*iel的帖子

适用于 Google APIS(云端硬盘和表格)的新华为设备(无 Google Play 服务)中 Google 登录的替代方案

我非常担心,因为华为个人联系了我,他们解释说新手机不会安装 Play 服务(旧消息)。我工作中的应用程序目前使用不同的 Google 服务:play-services-ads、play-services-auth、firebase-messaging、firebase-analytics、Crashlytics、Google Sheets、Google Drive。

我们使用 Google Sign-in 来获取 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);
} …
Run Code Online (Sandbox Code Playgroud)

android google-drive-api google-play-services google-sheets-api huawei-mobile-services

5
推荐指数
1
解决办法
1394
查看次数

使用 PdfDocument 将 Html 转换为 PDF

我正在尝试使用 PdfDocument 从 HTML 字符串生成 PDF:

https://developer.android.com/reference/android/graphics/pdf/PdfDocument.html

字符串示例:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
            <title>Example</title>
        </head>
        <body>
            <h1>Hello</h1>
        </body>
    </html>
Run Code Online (Sandbox Code Playgroud)

我知道如何从 WebView 生成 PDF 文件,但不知道如何从字符串 HTML 生成 PDF 文件。我怎么做?我在 stackoverflow.com 或 Google 中没有找到如何使用本机类 PDFDOCUMENT 执行此操作

android

1
推荐指数
1
解决办法
3143
查看次数