You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. In the **Solution Explorer** window, expand **Properties**, and click **AndroidManifest.xml**. Update the package name to match the package name you entered when adding Firebase Cloud Messaging to your project in the Google Firebase Console.
76
+
3. In the **Solution Explorer** window, expand **Properties**, and click **AndroidManifest.xml**. Update the package name to match the package name you entered when adding Firebase Cloud Messaging to your project in the Google Firebase Console.
77
77
78
78

79
-
3. Right-click your project, and select **Manage NuGet Packages...**.
80
-
4. Select the **Browse** tab. Search for **Xamarin.GooglePlayServices.Base**. Select **Xamarin.GooglePlayServices.Base** in the result list. Then, select **Install**.
79
+
4. Right-click your project, and select **Manage NuGet Packages...**.
80
+
5. Select the **Browse** tab. Search for **Xamarin.GooglePlayServices.Base**. Select **Xamarin.GooglePlayServices.Base** in the result list. Then, select **Install**.
81
81
82
82

83
-
5. In the **NuGet Package Manager** window, search for **Xamarin.Firebase.Messaging**. Select **Xamarin.Firebase.Messaging** in the result list. Then, select **Install**.
84
-
6. Now, search for **Xamarin.Azure.NotificationHubs.Android**. Select **Xamarin.Azure.NotificationHubs.Android** in the result list. Then, select **Install**.
83
+
6. In the **NuGet Package Manager** window, search for **Xamarin.Firebase.Messaging**. Select **Xamarin.Firebase.Messaging** in the result list. Then, select **Install**.
84
+
7. Now, search for **Xamarin.Azure.NotificationHubs.Android**. Select **Xamarin.Azure.NotificationHubs.Android** in the result list. Then, select **Install**.
85
85
86
86
### Add the Google Services JSON File
87
87
@@ -108,20 +108,22 @@ Your notification hub is configured to work with FCM, and you have the connectio
108
108
</intent-filter>
109
109
</receiver>
110
110
```
111
-
2. Add the following statements **before the application** element.
111
+
112
+
2. Add the following statements **before the application** element.
1. Gather the following information for your Android app and notification hub:
120
+
121
+
3. Gather the following information for your Android app and notification hub:
120
122
121
123
* **Listen connection string**: On the dashboard in the [Azure portal], choose **View connection strings**. Copy the `DefaultListenSharedAccessSignature` connection string for this value.
122
124
* **Hub name**: Name of your hub from the [Azure portal]. For example, *mynotificationhub2*.
123
-
3. In the **Solution Explorer** window, right-click your **project**, select **Add**, and then select **Class**.
124
-
4. Create a `Constants.cs` class for your Xamarin project and define the following constant values in the class. Replace the placeholders with your values.
125
+
4. In the **Solution Explorer** window, right-click your **project**, select **Add**, and then select **Class**.
126
+
5. Create a `Constants.cs` class for your Xamarin project and define the following constant values in the class. Replace the placeholders with your values.
125
127
126
128
```csharp
127
129
public static class Constants
@@ -130,19 +132,22 @@ Your notification hub is configured to work with FCM, and you have the connectio
130
132
public const string NotificationHubName = "<hub name>";
131
133
}
132
134
```
133
-
5. Add the following using statements to `MainActivity.cs`:
135
+
136
+
6. Add the following using statements to `MainActivity.cs`:
134
137
135
138
```csharp
136
139
using Android.Util;
137
140
using Android.Gms.Common;
138
141
```
139
-
6. Add the following properties to the MainActivity class. The TAG variable will be used to show an alert dialog when the app is running:
142
+
143
+
7. Add the following properties to the MainActivity class. The TAG variable will be used to show an alert dialog when the app is running:
17. **Run** your app on your device or loaded emulator
323
+
324
+
19. **Build** your project.
325
+
20. **Run** your app on your device or loaded emulator
313
326
314
327
## Send test notification from the Azure portal
315
328
@@ -324,7 +337,7 @@ Push notifications are normally sent in a back-end service like Mobile Services
324
337
In this tutorial, you sent broadcast notifications to all your Android devices registered with the backend. To learn how to push notifications to specific Android devices, advance to the following tutorial:
325
338
326
339
> [!div class="nextstepaction"]
327
-
>[Push notifications to specific devices](notification-hubs-aspnet-backend-android-xplat-segmented-gcm-push-notification.md)
340
+
>[Push notifications to specific devices](push-notifications-android-specific-devices-firebase-cloud-messaging.md)
0 commit comments