我正在尝试使用 firebase 发送通知......代码在7 天前工作,但现在我得到的只是(java.net.protocolexception 在响应被读取后无法写入请求正文) 每当我调用conn.getOutputStream();谢谢你们的帮助URL url = null; try { url = new URL("https://fcm.googleapis.com/fcm/send"); try { HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestProperty("Authorization","key=someKey"); conn.setRequestProperty("Content-Type", "application/json; UTF-8"); JSONObject data= new JSONObject(); JSONObject jsonObject=new JSONObject();
添加回答
举报
0/150
提交
取消