Sending A Push Notification To IOS Through A CLI Function

I am attempting to use a CLI function to send a push notification to both android and iOS devices. When I use the iOS version, no notification is received when sent from my function. However, when I send them from the Firebase console, it will receive the notification but only while the application is open. I am thinking I am missing either one or more crucial steps in setup or my function does not have all the needed data in the payload.

My function is sending as follows:

return Promise.all([token]).then(result=>{

             const payload = {
                 notification: {
                     title : likename + " liked your post!",
                     "priority" : "high"

             return admin.messaging().sendToDevice(token,payload);

I have my iOS application set up with a certificate and have implemented my APP delegate as follows:

import UIKit
import Flutter

@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    if #available(iOS 10.0, *) {
      // For iOS 10 display notification (sent via APNS)
      UNUserNotificationCenter.current().delegate = self

      let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
        options: authOptions,
        completionHandler: {_, _ in })
    } else {
      let settings: UIUserNotificationSettings =
      UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)


    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)

Any help is greatly appreciated and please let me know if you need additional information.



After hours of reflection, I realized I had only implemented code to respond to the onLaunch or onResume versions. I had to implement those methods to my code and now have success.