skip to Main Content

We are sending Push Notification through the Server.

I wanted to track the event, how many notification were received on iOS and Android.

  1. Is there any way to get this number with notification info?
  2. Is there any delegate method or any way in iOS that can confirm that we have received push notification in respective of notification clicked or not?

.

2

Answers


  1. In iOS you can use

    func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
    

    To make a call to your server and tell your server that the notification was received.

    Another solution would be to use FCM Rest to send the notifications

    POST /v1/{parent=projects/*}/messages:send

    https://firebase.google.com/docs/reference/fcm/rest

    If you include google analytics the Cloud messaging dashboard will have all the info if the user has provided permissions such as IDFA.

    Login or Signup to reply.
  2. In android, there is a method to intercept the FCM notification you can find the implementation in this thread.

    Each device notification is received by this callback so you can create some API or some logic to get the acknowledgement back.

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        // TODO(developer): Handle FCM messages here.
        Log.d(TAG, "From: ${remoteMessage.from}")
        // do the logic here.    
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search