鸿蒙开发配置官方地图

一共需要配置 p12 p7b cer csr 四个文件

p12文件配置

注意创建文件名必须是.p12

到AGC创建项目

AppGallery Connect

添加自己的项目名称

我没有开启 暂时不需要 看个人需求

下载刚创建的cer证书

回到我的项目中 点击刚创建的项目

点击这里

四个文件齐全了

   "metadata": [{
      "name": "client_id",
      "value": "******" //Client ID
    }]

运行项目

然后重新运行项目

这样地图就可以了

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
鸿蒙开发中,可以使用HttpURLConnection或者OkHttp来发送HTTP请求。 其中,HttpURLConnection是Android提供的网络请求框架,可以在鸿蒙上使用。具体配置步骤如下: 1. 在build.gradle文件中添加以下依赖: ``` dependencies { implementation 'com.squareup.okhttp3:okhttp:4.9.0' } ``` 2. 在代码中使用HttpURLConnection发送HTTP请求: ``` import java.net.HttpURLConnection; import java.net.URL; import java.io.BufferedReader; import java.io.InputStreamReader; public class HttpUtil { public static String sendHttpRequest(String urlStr) { StringBuilder result = new StringBuilder(); try { URL url = new URL(urlStr); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); connection.connect(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; while ((line = reader.readLine()) != null) { result.append(line); } reader.close(); connection.disconnect(); } catch (Exception e) { e.printStackTrace(); } return result.toString(); } } ``` 其中,sendHttpRequest方法中的urlStr参数为请求的URL地址,调用该方法即可发送HTTP请求。 如果想要使用OkHttp发送HTTP请求,可以参考以下示例代码: ``` import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class HttpUtil { public static String sendHttpRequest(String urlStr) { String result = ""; try { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url(urlStr) .build(); Response response = client.newCall(request).execute(); result = response.body().string(); } catch (Exception e) { e.printStackTrace(); } return result; } } ``` 使用OkHttp发送HTTP请求的步骤与使用HttpURLConnection类似,只需要在代码中进行相应的调整即可。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值