@@ -16,12 +16,9 @@ public class ReactNativeFirebaseMessagingService extends FirebaseMessagingServic
1616 private static final String TAG = "ReactNativeFMS" ;
1717
1818 private static ReactNativeNotificationsHandler notificationHandler ;
19- private static Context appContext ;
2019 private static String notificationChannelID ;
2120
2221 public static void createNotificationHandler (Context context ) {
23- appContext = context ;
24-
2522 if (notificationHandler == null ) {
2623 notificationHandler = new ReactNativeNotificationsHandler ();
2724 NotificationHubUtil notificationHubUtil = NotificationHubUtil .getInstance ();
@@ -63,15 +60,14 @@ public void onNewToken(String token) {
6360
6461 @ Override
6562 public void onMessageReceived (RemoteMessage remoteMessage ) {
66- Log .d (TAG , "From : " + remoteMessage .getFrom ());
63+ Log .d (TAG , "Remote message from : " + remoteMessage .getFrom ());
6764
6865 if (notificationHandler == null ) {
69- Log .e (TAG , "Notification handler hasn't been created" );
70- return ;
66+ createNotificationHandler (this );
7167 }
7268
7369 Bundle bundle = remoteMessage .toIntent ().getExtras ();
74- notificationHandler .sendNotification (appContext , bundle , notificationChannelID );
75- notificationHandler .sendBroadcast (appContext , bundle , 0 );
70+ notificationHandler .sendNotification (this , bundle , notificationChannelID );
71+ notificationHandler .sendBroadcast (this , bundle , 0 );
7672 }
7773}
0 commit comments