서버단에서 밑에 형식으로 notification, data 두개를 한번에 보냅니다..
sdk 24버전에서는 백그라운드 포그라운드 이상없이 도착을합니다.
하지만 sdk28버전에서는 백그라운드만 오고 포그라운드는 오지 않네요
알림 채널 설정이랑 관련있는 오류인가요??
해결을 못하겠습니다...

JsonObject json = new JsonObject();
JsonObject notification = new JsonObject();
JsonObject data = new JsonObject();
//JsonObject dataJson = new JsonObject();
// 알림 부분
//디바이스전송 (앱단에서 생성된 토큰키)
json.addProperty("to", fcmToken);
json.add("notification", notification);
json.add("data", data);
//앱 백그라운드 발송시 기본는 이 내용을 참조한다
notification.addProperty("title", company);
notification.addProperty("body", "No."+"11"+" 백그라운드 "+error); // Notification body
notification.addProperty("icon", "ic_maroo");
notification.addProperty("sound", "default");
//앱 포그라운드 발송
data.addProperty("title", company);
data.addProperty("message", "포그라운드 "+error);
data.addProperty("icon", "ic_maroo");
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
sendNotification(remoteMessage.getData().get("message"), remoteMessage.getData().get("title"));
Log.d("SDK25", "데이타");
}
private void sendNotification(String messageBody, String title) {
Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_maroo)
.setContentTitle(title)
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
.setVibrate(new long[]{1,1000})
.setColor(0xd81b60);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
}