Skip to content

Push notifications integration

Learn how to set up Android, FireOS, and iOS push notifications for Xamarin.

Prerequisites

To use this feature, you’ll need to integrate Braze SDK for the Xamarin platform.

Integrating push notifications

To integrate push notifications for Xamarin, you’ll need to complete the steps for native Android push notifications. The following steps are only a summary. For a full walkthrough, see the native push notification guide.

Step 1: Update your project

  1. Add Firebase to your Android project.
  2. Add the Cloud Messaging library to your Android project’s build.gradle:
    1
    
      implementation "google.firebase:firebase-messaging:+"
    

Step 2: Create your JSON credentials

  1. In Google Cloud, enable the Firebase Cloud Messaging API.
  2. Select Service Accounts > your project > Create Service Account, then enter a service account name, ID, and description. When you’re finished, select Create and continue.
  3. In the Role field, find and select Firebase Cloud Messaging API Admin from the list of roles.
  4. In Service Accounts, choose your project, then select  Actions > Manage Keys > Add Key > Create new key. Choose JSON, then select Create.

Step 3: Upload your JSON credentials

  1. In Braze, select  Settings > App Settings. Under your Android app’s Push Notification Settings, choose Firebase, then select Upload JSON File and upload the credentials you generated earlier. When you’re finished, select Save.
  2. Enable automatic FCM token registration, by going to Firebase Console. Open your project, then select  Settings > Project settings. Select Cloud Messaging, then under Firebase Cloud Messaging API (V1), copy the number in the Sender ID field.
  3. In your Android Studio project and the following to your braze.xml.
1
2
  <bool translatable="false" name="com_braze_firebase_cloud_messaging_registration_enabled">true</bool>
  <string translatable="false" name="com_braze_firebase_cloud_messaging_sender_id">FIREBASE_SENDER_ID</string>

Step 1: Complete the initial setup

See the Swift integration instructions for information about setting up your application with push and storing your credentials on our server. Refer to the iOS MAUI sample application for more details.

Step 2: Request push notifications permission

Our Xamarin SDK now supports automatic push set up. Set up push automation and permissions by adding the following code to your Braze instance configuration:

1
2
configuration.Push.Automation = new BRZConfigurationPushAutomation(true);
configuration.Push.Automation.RequestAuthorizationAtLaunch = false;

Refer to the iOS MAUI sample application for more details. For more details, see the Xamarin documentation for Enhanced User Notifications in Xamarin.iOS.

HOW HELPFUL WAS THIS PAGE?
New Stuff!