有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

firebase Java使用HTTP v1发送错误字符的中文通知

请求标头与正式文档相同。为什么安卓在我使用中文时收到了错误的字符?使用英语是正确的

private HttpURLConnection getConnections() throws IOException {
    URL url = new URL(BASE_URL + FCM_SEND_ENDPOINT);
    HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
    httpURLConnection.setRequestProperty("Authorization", "Bearer " + getAccessTokens());
    httpURLConnection.setRequestProperty("Content-Type", "application/json; UTF-8");
    return httpURLConnection;
}

共 (0) 个答案