|
|
@@ -50,11 +50,6 @@ public class FirebasePushService extends FirebaseMessagingService {
|
|
|
public void onNewToken(String token) {
|
|
|
Log.d("APP# FirebasePushService | onMessageReceived", "|" + "Refreshed token: " + token);
|
|
|
|
|
|
- // If you want to send messages to this application instance or
|
|
|
- // manage this apps subscriptions on the server side, send the
|
|
|
- // Instance ID token to your app server.
|
|
|
-
|
|
|
-// sendRegistrationToServer(token);
|
|
|
FirebaseHelper.getInstance().sendRegistrationToServer(token);
|
|
|
}
|
|
|
|
|
|
@@ -78,6 +73,8 @@ public class FirebasePushService extends FirebaseMessagingService {
|
|
|
PushMessageManager.savePushMessages(new PushMessageManager(PushMessageManager.getPushMessages()).addPushBean(bean));
|
|
|
|
|
|
sendNotification(bean.getTitle(), bean.getContents());
|
|
|
+
|
|
|
+ PushMessageBroker.getInstance().push(bean);
|
|
|
}
|
|
|
|
|
|
// Check if message contains a notification payload.
|
|
|
@@ -92,11 +89,12 @@ public class FirebasePushService extends FirebaseMessagingService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- // /**
|
|
|
-// * Create and show a simple notification containing the received FCM message.
|
|
|
-// *
|
|
|
-// * @param messageBody FCM message body received.
|
|
|
-// */
|
|
|
+ /**
|
|
|
+ * Create and show a simple notification containing the received FCM message.
|
|
|
+ *
|
|
|
+ * @param title FCM message title received.
|
|
|
+ * @param messageBody FCM message body received.
|
|
|
+ */
|
|
|
private void sendNotification(String title, String messageBody) {
|
|
|
Intent intent = new Intent(this, MainActivity.class);
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
|
@@ -128,24 +126,4 @@ public class FirebasePushService extends FirebaseMessagingService {
|
|
|
|
|
|
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
|
|
|
}
|
|
|
-
|
|
|
-// private void sendNotification(String title, String message) {
|
|
|
-// 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_CANCEL_CURRENT);
|
|
|
-//
|
|
|
-// Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
|
|
-// NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
|
|
|
-// .setLargeIcon(BitmapFactory.decodeResource(getResources(), android.R.drawable.ic_dialog_info))
|
|
|
-// .setSmallIcon(R.mipmap.ic_launcher)
|
|
|
-// .setContentTitle(title)
|
|
|
-// .setContentText(message)
|
|
|
-// .setAutoCancel(true)
|
|
|
-// .setSound(defaultSoundUri)
|
|
|
-// .setContentIntent(pendingIntent);
|
|
|
-//
|
|
|
-// NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
-// notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
|
|
|
-// }
|
|
|
}
|