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
var intent = new Intent(this, typeof(MainActivity));
302
-
intent.AddFlags(ActivityFlags.ClearTop);
303
-
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
304
-
305
-
var notificationBuilder = new NotificationCompat.Builder(this)
306
-
.SetContentTitle("FCM Message")
307
-
.SetSmallIcon(Resource.Drawable.ic_launcher)
308
-
.SetContentText(messageBody)
309
-
.SetAutoCancel(true)
310
-
.SetShowWhen(false)
311
-
.SetContentIntent(pendingIntent);
312
-
313
-
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
280
+
19. Add the following methods to the MyFirebaseMessagingService class to receive the FCM registration token and send it to the Notification Hubs instance (hub).
var regID = hub.Register(token, tags.ToArray()).RegistrationId;
323
297
324
-
19. **Build** your project.
325
-
20. **Run** your app on your device or loaded emulator
298
+
Log.Debug(TAG, $"Successful registration of ID {regID}");
299
+
}
300
+
```
301
+
1. **Build** your project.
302
+
1. **Run** your app on your device or loaded emulator
326
303
327
304
## Send test notification from the Azure portal
328
305
329
306
You can test receiving notifications in your app with the **Test Send** option in the [Azure portal]. It sends a test push notification to your device.
330
307
331
308

332
309
333
-
Push notifications are normally sent in a back-end service like Mobile Services or ASP.NET through a compatible library. If a library is not available for your back-end, you can also use the REST API directly to send notification messages.
310
+
Push notifications are normally sent in a back-end service like Mobile Services or ASP.NET through a compatible library. If a library isn't available for your back-end, you can also use the REST API directly to send notification messages.
Copy file name to clipboardExpand all lines: includes/notification-hubs-enable-firebase-cloud-messaging-xamarin.md
+10-15Lines changed: 10 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
author: spelluru
6
6
ms.service: notification-hubs
7
7
ms.topic: include
8
-
ms.date: 03/11/2019
8
+
ms.date: 08/01/2019
9
9
ms.author: spelluru
10
10
ms.custom: include file
11
11
---
@@ -16,28 +16,23 @@
16
16

17
17
18
18
3. On the **Add Firebase to your Android app** page, take the following steps:
19
-
1.
20
19
1. For the **Android package name**, enter a name for your package. For example: `tutorials.tutoria1.xamarinfcmapp`.
21
20
22
21

22
+
2. Select **Register app**.
23
+
1. Select **Download google-services.json**. Then save the file into the folder of your project and select **Next**. If you haven't created the Visual Studio project yet, you can do this step after you create the project.
23
24
24
-
2. Select **Register app**.
25
-
1.
26
-
1. Select **Download google-services.json**. Then save the file into the **app** folder of your project and select **Next**.
4. If you haven't downloaded the **google-services.json** file, you can do download it on this page.
40
34
41
-
1. Switch to the **Cloud Messaging** tab at the top.
35
+

36
+
1. Switch to the **Cloud Messaging** tab at the top. Copy and save the **Server key** for later use. You use this value to configure your notification hub.
42
37
43
-
1. Copy and save the **Legacy Server key** for later use. You use this value to configure your notification hub.
38
+

0 commit comments