Push Notifications
Learn how to configure Push Notifications in your Wisej Mobil
Local and push notifications are great for keeping users informed with timely and relevant content, whether your app is running in the background or inactive. Notifications can display a message, play a distinctive sound, or update a badge on your app icon.
You must have access to the Wisej Mobile Self-Hosted or Managed package to configure Push Notifications.

Requirements

  • Wisej Mobile Self-Hosted or Managed Package

Android

  • Server Authorization Key
You can generate a Server Authorization key from the Firebase Console.
Navigate to Project Settings > Cloud Messaging > Server Key

iOS

  • .p12 Certificate for the app bundle
  • Bundle Identifier (i.e. com.itg.wisej.mobile)
Apple Developer Documentation
Generating an APNS p12 Certificate

Usage

  • Wisej Application with Wisej-2-MobileIntegration NuGet package.

Get the Device's Notification Token

1
private void Page1_Load(object sender, EventArgs e)
2
{
3
Device.SubscribedNotification += Device_SubscribedNotification;
4
}
5
6
private void Device_SubscribedNotifications(object sender, DeviceEventArgs e)
7
{
8
// e.Data is the remote notification token.
9
var token = e.Data;
10
11
// updated token also available in:
12
var token = Device.Info.DeviceToken;
13
}
Copied!

Sending a Push Notification (Android)

1
private void PushNotification(string title, string message, int badge)
2
{
3
var serverKey = File.ReadAllText(Application.MapPath("Data/ServerAuthKey.lic"));
4
NotificationResponse result = NotificationManager.PushAndroid(serverKey, new
5
{
6
to = Device.Info.DeviceToken,
7
notification = new
8
{
9
badge = badge,
10
title = title,
11
body = message,
12
}
13
});
14
AlertBox.Show(result.ToString());
15
}
Copied!
Firebase Cloud Messaging HTTP protocol
Firebase
Android Push Notification API

Sending a Push Notification (iOS)

1
private void PushNotification(string title, string message, int badge)
2
{
3
var certPath = Application.MapPath("Data\\Certificates.p12");
4
NotificationResponse result = NotificationManager.PushiOS("com.Wisej.Mobile.Demo", new string[] { Device.Info.DeviceToken }, certPath, "", new
5
{
6
aps = new
7
{
8
alert = new
9
{
10
title = title,
11
body = message,
12
},
13
badge = badge
14
}
15
});
16
AlertBox.Show(result.ToString());
17
}
Copied!
Local and Remote Notification Programming Guide: Payload Key Reference
iOS Push Notification API
Last modified 1mo ago