华为附近搜索错误 BUSINESS_VERIFICATION_FAILED

发布于 2025-01-10 22:00:16 字数 929 浏览 0 评论 0原文

我一直在使用站点套件服务来获取附近经纬度偏向的位置。 但不幸的是这个错误突然出现。 错误日志

我研究了解释这一点的文档和错误代码 错误代码description

但搜索到的参数都是文档中提供的参数(用于测试目的),除了 api key 之外。

val searchService: SearchService = SearchServiceFactory.create(
        this, URLEncoder.encode(
            getString(R.string.huawei_maps_key),
            "UTF-8"
        )
    )
    val request = NearbySearchRequest()
    val location = Coordinate(48.893478, 2.334595)
    request.location = location
    request.query = "Paris"
    request.radius = 1000
    request.hwPoiType = HwLocationType.ADDRESS
    request.language = "fr"
    request.pageIndex = 1
    request.pageSize = 5
    request.strictBounds = false

I have been using Site kit service to get nearby locations on the biases of Lat Lng.
But unfortunately this error appears out of no where.
error log

I had studied the documentation and error code which explain this
error code description

But the searched parameters are all those which are provided in documentations(for testing purpose) except the api key.

val searchService: SearchService = SearchServiceFactory.create(
        this, URLEncoder.encode(
            getString(R.string.huawei_maps_key),
            "UTF-8"
        )
    )
    val request = NearbySearchRequest()
    val location = Coordinate(48.893478, 2.334595)
    request.location = location
    request.query = "Paris"
    request.radius = 1000
    request.hwPoiType = HwLocationType.ADDRESS
    request.language = "fr"
    request.pageIndex = 1
    request.pageSize = 5
    request.strictBounds = false

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

送舟行 2025-01-17 22:00:16

尝试将以下代码更改

val searchService: SearchService = SearchServiceFactory.create(
        this, URLEncoder.encode(
            getString(R.string.huawei_maps_key),
            "UTF-8"
        )
    )

为:

   val apiKey: String?
        get() {
            // get apiKey from AppGallery Connect
            val apiKey = "your api key"

            // need encodeURI the apiKey
            return try {
                URLEncoder.encode(apiKey, "utf-8")
            } catch (e: UnsupportedEncodingException) {
                Log.e(TAG, "encode apikey error")
                null
            }
        }


searchService = SearchServiceFactory.create(this, apikey)

Try to change your following code

val searchService: SearchService = SearchServiceFactory.create(
        this, URLEncoder.encode(
            getString(R.string.huawei_maps_key),
            "UTF-8"
        )
    )

to:

   val apiKey: String?
        get() {
            // get apiKey from AppGallery Connect
            val apiKey = "your api key"

            // need encodeURI the apiKey
            return try {
                URLEncoder.encode(apiKey, "utf-8")
            } catch (e: UnsupportedEncodingException) {
                Log.e(TAG, "encode apikey error")
                null
            }
        }


searchService = SearchServiceFactory.create(this, apikey)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文