OkHttpClient client = new OkHttpClient();
JSONObject json=new JSONObject();
JSONObject dataJson=new JSONObject();
dataJson.put("body","You got a message");
dataJson.put("title","You got a message");
json.put("notification",dataJson);
json.put("to",regToken);
RequestBody body = RequestBody.create(JSON, json.toString());
Request request = new Request.Builder()
.header("Authorization","key=" + "dd")
.url("https://fcm.googleapis.com/fcm/send")
.post(body)
.build();
Response response = client.newCall(request).execute();
String finalResponse = response.body().string(); Google Push Notification Ne Ses Var Ne Titreşim Var Ne Resim Var
1
●161
- 02-08-2019, 10:27:13Merhaba, kodum bu
- 04-08-2019, 11:07:11Selamlar.
FCM'de 2 Tür notification var. Biri notification message, biri data message. İkisi arasındaki request formatı farklı. Şuan da notification message gönderiyorsunuz.
Sizin data message göndermeniz gerekiyor. Data message türünce, sound ve öncelik parametreleri set edebiliyorsunuz.
Bu sayfa herşeyi açıklıyor. Okuduğunuzda çözüme ulaşacağınızdan eminim
Başarılar
