Method Called When Notification Silent is True or False iOS Swift Firebase

Good day guys, today I want to share about iOS programming. Before I got the idea of this article, I got an issue. The issue is when you want to get notification data when user click on notification banner or user is running the app. It's different way to get the notification that I will give you the code below But I will explain a little bit first.

I have tried with firebase library, so make sure you have configured your firebase or any libraries that you used for your notification. But it will be better if we used the same. You need to set it according to documation that I have read. Mostly the configuration will be in AppDelegate class. Then from AppDelegate you will go into your others ViewController.

There are the method that's called that I want to show to you guys, the methods is userNotificationCenter and didReceiveRemoteNotification. I will give silent true or silent false comment for you guys. So It will be easy for you to understand what I'm trying to figure it out.

As you can see self.receiveNotif(userInfo : userInfo) is my method to handle what will next happen. It's like going to spesific view controller. Because it will have many variables to handle so I better have a one method to handle all it all. It will be simple I use just one method to handle notification in app.

You need to test it out before you make it release. Notification works well on real device not simulator. When you use simulator, it only works when app is in foreground or you're running your app. If you have any question related to this post, please feel free ask. Thanks for visiting my simple blog. God bless you all. :D.

Popular posts from this blog

How to restart the app with flutter Android and iOS

Missing system image Android Studio solution

How to have ConstraintLayout inside ScrollView and ScrollView inside ConstraintLayout Android