标签: huawei-mobile-services

HMS Map Kit - 聚类

我想将 Google 地图功能迁移到 HMS。大部分零部件很容易迁移到华为,但我有集群的功能,我使用ClusterItem,并ClusterManagerDefaultClusterRenderer我的GoogleMap的显示标记簇作为一个标志,如果很多人有在地图上。

HMS 中缺少此功能。我找到了它MarkerHWMarkerCluster但它的系统完全不同,HWMarkerCluster甚至在 Android 的导入类选项中都没有找到。它仅适用于 Javascript API。

如果在 HMS 中有任何替代方案,有什么建议吗?因为我正在阅读 Map Kit 文档一个小时,但我找不到任何东西。

android huawei-mobile-services

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

6
推荐指数
0
解决办法
251
查看次数

蓝牙低功耗 (BLE) 设备与华为手机的连接问题

我们有一款应用程序使用蓝牙低功耗 (BLE) 技术与活动跟踪器等硬件设备进行通信。

所有支持 BLE 的手机均可进行通信,但当我们尝试将追踪器与华为手机连接时,它根本无法工作。

流程如下:

  • 应用程序搜索活动追踪器
  • 当应用程序找到跟踪器时,它会调用蓝牙 Gatt 服务的 connect 方法。
  • 跟踪器应该成功连接,并且应该在“OnConnectionStateChanged()”方法中给出状态 0 和状态 2(成功)的响应。但问题是,它与跟踪器连接不成功。当应用程序发起连接调用时,它立即给出状态为 133(蓝牙 Gatt 失败)的断开回调。

以下是显示问题的日志:

I/Bluetooth: BtGatt.GattService:onConnected() - clientIf=6, connId=0, address=E6:4F:92:69:B7:95
I/Bluetooth: BluetoothProfileService:isAvailable(), mStartError=false, mCleaningUp=false
BluetoothGatt Check Status and NewState: 133|0
I/Bluetooth: BtGatt.GattService:clientDisconnect() - address=E6:4F:92:69:B7:95, connId=null
Run Code Online (Sandbox Code Playgroud)

我们还使用“nRF Connect”应用程序进行了测试,在该应用程序中,它也提供了状态为 133(蓝牙 Gatt 故障)的断开回调。请查找随附的屏幕截图。

在此输入图像描述

如果有人遇到同样的情况,可以帮助我们吗?

android bluetooth bluetooth-lowenergy android-bluetooth huawei-mobile-services

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

适用于 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
查看次数

SQLiteBlobTooBigException - 华为设备,Android 9 和 10

我仅在华为系列设备、Android 9 和 10 上收到android.database.sqlite.SQLiteBlobTooBigException

设备崩溃

onUpgrade方法中我想向表添加新列

 @Override
 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
...
        case 43:
               addColumn(db, TABLE_LESSONS, _SPEED_GAME_EASY_FINISHED, " INTEGER DEFAULT 0");
               addColumn(db, TABLE_LESSONS, _SPEED_GAME_HARD_FINISHED, " INTEGER DEFAULT 0");
               addColumn(db, TABLE_LESSONS, _MEMORY_GAME_EASY_FINISHED, " INTEGER DEFAULT 0");
...
}
Run Code Online (Sandbox Code Playgroud)
    private void addColumn(SQLiteDatabase db, String table, String column, String columnType) {
        boolean isColumnExist = false;
        AbstractWindowedCursor cursor = null;
        String selectQuery = "SELECT * FROM " + table + " LIMIT 0,1";

        try { …
Run Code Online (Sandbox Code Playgroud)

java database sqlite android huawei-mobile-services

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

HMS地理编码功能

我目前正在开发一些map'ish应用程序,我想支持依赖HMS服务的华为手机。我已经成功地实现了地图和标记,但是我在地理编码坐标方面遇到了问题,使用谷歌它很简单,Geocoder在 HMS 中我没有看到任何类似的东西,我一直在查看该site包,但看起来不像这样应该使用,我也看到他们确实有geocodereverseGeocode但是在JS库中,android hms地图库中不存在这样的东西。

也许有人已经遇到过类似的问题,并且对如何使用 hms 对我的坐标进行地理编码有一些提示?

android huawei-mobile-services

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

无法发送通知[错误:80300002](HMS Core推送服务)-Web App

我有一个网络应用程序项目,可以向手机浏览器发送推送通知。我已成功从我的华为设备检索推送令牌,但无法从我的服务器通过 HMS Push Kit 发送通知,收到 HTTP 401 且错误正文包含:

{ 
  "msg": "No permission to send message to these tmIDs", 
  "code": 80300002
}
Run Code Online (Sandbox Code Playgroud)

我已联系客户服务并被指向以下 URL,我执行了其中列出的所有操作,但仍然遇到相同的错误。

https://developer.huawei.com/consumer/jp/doc/development/HMSCore-Guides-V5/commonerror-0000001059816656-V5

这是返回错误的 URL (POST)(从我的服务器发送,使用项目设置中的应用程序 ID):

https://push-api.cloud.huawei.com/v1/my_app_id_from_project_settings/topic:订阅

使用控制台中的 OAuth 2.0 客户端 ID/秘密(“凭据”)从以下 URL 检索访问令牌:

https://oauth-login.cloud.huawei.com/oauth2/v3/token

我还从控制台申请了华为帐号(应用服务 > 开发 > 华为帐号,使用相同的 OAuth 2.0 客户端 ID/密钥)。

我为排除故障所做的事情:

  • 启用推送套件(控制台级别和项目级别)
  • 删除反斜杠 (\) 并进行 URL 编码的访问令牌
  • 服务器位置:新加坡(推送套件已禁用并按照建议重新启用)
  • POST 请求主体包含一个 JSON 主体,只有 2 个属性topic(字符串)和tokenArray(字符串数组,例如["token1", "token2"]
  • POST 请求标头Authorization: …

huawei-mobile-services

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

在Android上通过Intent启动Huawei Petal Maps Directions

是否可以推出华为花瓣地图,使用意图从 A 点导航到 B 点,就像谷歌地图一样?如果是,怎么办?

android android-intent huawei-mobile-services huawei-developers

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

EmojiCompat for Huawei devices

I would like to support emojis for Huawei devices in my app. For all other vendors I use code like this to init EmojiCompat:

 val fontRequest = FontRequest(
            "com.google.android.gms.fonts",
            "com.google.android.gms",
            "Noto Color Emoji Compat",
            R.array.com_google_android_gms_fonts_certs
        )
        val config = FontRequestEmojiCompatConfig(context, fontRequest)
        EmojiCompat.init(config)
Run Code Online (Sandbox Code Playgroud)

But for Huawei devices, for they do not have access to google resources (my guess), it does not work, and EmojiCompat doesn't get initialized. I know that BundledEmojiCompatConfig could be used, but I would prefer always to fetch …

fonts android emoji google-fonts huawei-mobile-services

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

华为短信检索器 api 无法正常工作且华为设备

我正在尝试在华为设备中检索 OTP。但它不起作用。

我已经在华为开发者控制台中创建了满足所有要求的应用程序。

下面是我用来检索短信的代码。

private fun initSmsManager() {

        val task = ReadSmsManager.start(this@MainActivity)

        task.addOnCompleteListener {

            if (task.isSuccessful) {
                // The service is enabled successfully. Continue with the process.
                Toast.makeText(this, "ReadSms service has been enabled.", Toast.LENGTH_LONG).show()
            } else
                Toast.makeText(this, "The service failed to be enabled.", Toast.LENGTH_LONG).show()
        }
        task.addOnSuccessListener(this, OnSuccessListener {
                if(task.isSuccessful){
                    Toast.makeText(this, "ReadSms service has been enabled.", Toast.LENGTH_LONG).show()
                    myReceiver = MyBroadcastReceiver();
                    val intentFilter = IntentFilter(READ_SMS_BROADCAST_ACTION)
                    registerReceiver(myReceiver, intentFilter)
                }
        })
        task.addOnFailureListener(this, OnFailureListener {
            Toast.makeText(this,it.message,Toast.LENGTH_SHORT).show();
        })
    }
Run Code Online (Sandbox Code Playgroud)

广播接收器

class MyBroadcastReceiver : BroadcastReceiver() {

    companion …
Run Code Online (Sandbox Code Playgroud)

sms-retriever-api huawei-mobile-services huawei-account huawei-developers

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