Xamarin Forms One Signal (Part 2)

Hello friends, after completing the transactions on One Signal, we can now make transactions on our project. For this we need to go to our project and install the One Signal package.

 

After adding the package, we need to start OneSignal in App.cs. You need the OneSignal key here. For this, we need to go to the Settings section in our project and go to the Key & IDs section. Here we need the OneSignal App Id.

Then we need to add OneSignal to the project. Here we can start the instant OneSignal.

Then we need to make adjustments in the Android section. For Android adjustments, we first need to add a few lines in the manifest file. Paste the code below into the manifest file to allow it.

Then make sure to write this code in the Application tags.

Our Android processes are over. Next we will do for iOS. It says that we do a lot of operations in One Signal documentation, but when we do these things, it cannot be said that it works very well. From my experience, we only need to come to the Info.plist file and open the notification permission.

After making the necessary adjustments, it is necessary to check when the notification is received and the notification is opened. For this we need to come to the App.cs file. We will add 2 more functions under the function we started OneSignal. When the notification comes here, if you want to show the notifications in the application with a list, you can save it to Local and show it to the user. The function that is triggered when the notification is opened is the function that should be directed to the notification. Clicking here, you can open the application and redirect according to the type of notification.

We are now ready to send notifications via OneSignal. I’ll show you how to send it simply. If you like silent push, how to add test devices, how to send notifications from within the application, how to send notifications to certain users or if you have other questions, you can review OneSingal’s document or contact me.

After making the necessary adjustments, when you run the application, you can see how many devices are registered with your notification service.

To send a notification, you need to come to the messages section on OneSignal and say new notification from here. Then you need to enter a title and description. After entering this information, you can send notifications to all registered users.

In the meantime, a short reminder notifications are coming to Android emulators, but despite claiming that OneSignal is also working on iOS simulators, I couldn’t run it. So you can get healthier results in a physical device.

You can contact me by sending an e-mail or comment for places where you are stuck or want to ask.

Good work.

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.