我正在尝试使用 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();
相关分类