android qiscus sdk를 사용하여 알림을 구현하는 데 문제가 있습니다.다른 사용자로부터 알림을 표시하는 방법은 무엇입니까?
FirebaseService 클래스 FirebaseMessagingService를 만듭니다.
그러나 누군가 채팅 할 때 onMessageReceived에 메시지를 남길 수 없습니다. 누구든지 내가 도와 줄 수 있니? 고맙습니다.
android qiscus sdk를 사용하여 알림을 구현하는 데 문제가 있습니다.다른 사용자로부터 알림을 표시하는 방법은 무엇입니까?
FirebaseService 클래스 FirebaseMessagingService를 만듭니다.
그러나 누군가 채팅 할 때 onMessageReceived에 메시지를 남길 수 없습니다. 누구든지 내가 도와 줄 수 있니? 고맙습니다.
QiscusFirebaseService로 확장하고 remoteMessege를 handleMessageReceived로 설정해야합니다.
QiscusFirebaseService.handleMessageReceived (remoteMessage) https://gist.github.com/fauzisho/64b89df651c91b1dd6d4d096c8d826ca
내가 그 당신이 당신의 문제를 해결하는 데 도움이 될 수 있습니다 희망 상세 예를 들어
try {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
String title = "" + "";
PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Uri defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
if (defaultSound == null) {
defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
if (defaultSound == null) {
defaultSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
}
}
Notification.Builder builder = new Notification.Builder(context)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setSmallIcon(icon)
.setLights(Color.BLUE, 20, 80)
.setAutoCancel(true)
.setSound(defaultSound);
if (bitmap != null) {
builder.setLargeIcon(bitmap);
}
Notification not = new Notification.BigTextStyle(builder).bigText(message).build();
if (defaultSound == null) {
not.defaults |= Notification.DEFAULT_VIBRATE;
not.defaults |= Notification.DEFAULT_SOUND;
}
notificationManager.notify(0, not);
}
catch (Exception e) {
e.printStackTrace();
}`