JSONObject obj = new JSONObject();
obj.put("msg", "Hello World!!");
HttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost("https://fcm.googleapis.com/fcm/send/....");
postRequest.addHeader("accept", "application/json; charset=UTF-8");
postRequest.addHeader("auth", "96o.....");
postRequest.addHeader("p256dh", "BOAM5S0-fC79....");
postRequest.setEntity(new StringEntity(obj.toString(), "UTF-8"));
try {
HttpResponse postResponse = httpClient.execute(postRequest);
System.out.println(postResponse);
} catch(Exception e) {
}
При регистрации postResponse, я получаю HTTP / 1.1 Unauthorized. Что не так с моим кодом?