

fcm 을 이용하여 푸시 메세지 보내는 연습중입니다.
위 스샷에 보이듯이...메세지는 안 오고...타이틀만 옵니다..
메세지는 구글 사이트에서 보내고 있구요..아직 서버가 마련되지 않아서요..
다음은 소스입니다.
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
private static final String TAG = "FirebaseMsgService";
// [START receive_message]
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
//추가한것
sendNotification(remoteMessage.getData().get("message"));
}
private void sendNotification(String messageBody) {
Log.e("KSJ", "Received message : " + messageBody);
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.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher))
.setContentTitle("FCM Push Test by ksj")
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setLights(000000255, 500, 2000)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
PowerManager pm = (PowerManager)this.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "KSJ");
wakeLock.acquire(5000);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}
}
푸시 메세지는 이번이 첨이라 뭐가 문제인지 잘 모르겠어서..
이렇게 질문을 드립니다.
카톡같은 경우에는 메세지까지 다 보이잖아여.. 그런걸 원합니다....간절하게..