iOS - firebase push notifications are not showing when app is closed for iOS. Working fine for Android

Ionic 3- I am using this plugin “” for push notifications with firebase.
When the app is closed push notifications coming for the android phone but not for iOS. When we open app on the iOS phone then notifications coming.

I am using below code for sending push notifications:

function send_notification_to_user_mobile($title, $message, $userId, $notificationType, $dataId) {
$DEVICE_TOKEN = get_user_meta($userId,‘firebase_device_token’,TRUE);
$current_user_id = getUserId();
$display_name = bp_core_get_user_displayname($current_user_id);
$message = ‘’.$display_name.’’.$message;
$SERVER_KEY = ‘adfsdadfsdsafsdafdsasdsafdasd’;
$data =
‘data’=> array(
‘title’=> $title,
‘message’=> $message,
‘isadmin’=> ‘no’,
‘notificationType’=> $notificationType,
‘dataId’=> $dataId,
‘content_available’=> true,
‘priority’=> ‘high’,
$data_json = json_encode($data);

        $request_headers = array();
        $request_headers[] = 'Content-Type: application/json';
        $request_headers[] = 'Authorization: key='.$SERVER_KEY;

        $ch = curl_init();
        $url  = '';
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $response  = curl_exec($ch);


Are these set in your XCode project?

XCode > Project > Capabilities > Push Notifications > On

XCode > Project > Capabilities > Background Modes > Remote notifications (checked)

Im using the cordova fcm plugin (cordova-plugin-fcm 2.1.2 “FCMPlugin”) and it’s working for me. FYI, with the fcm plugin, when your app is in the foreground, you have to handle the notification yourself. It won’t appear otherwise.

I deleted/reinstalled the app on my test device, not sure if this had anything to do with getting it working.