Mobile push notifications

Notifications are an important part of Weavy. Whenever something happens that you follow or anyone mentions you or your team, you will be notified. Weavy has built in notifications in the web interface but will also try to push to a mobile device if configured correctly.

Weavy Push Notification Providers

How you want to push the notifications is up to you. Weavy has an INotificationProvider provider interface that can be implemented with the service of your choice. We provide a default implementation which is Azure Notification Hubs. You can learn more about the INotificationProvider interface in the Create a Push Notification Provider tutorial.

Sending from Azure Notification Hubs

Sending push notifications from Azure Notification Hubs is the default implementation in Weavy.

Azure Setup

In Azure Portal, do the following:

  1. Create a new Notification Hub. Select the Free pricing tier for this purpose.
  2. On the newly created Hub, configure Apple (APNS) and/or Google (GCM/FCM). More information on how to create an Apple push notification certificate and a Google Firebase project can be found here:
    Setup for iOS
    Setup for Android
  3. On Access Policies, copy the DefaultListenSharedAccessSignature and the DefaultFullSharedAccessSignature for later use when setting up Weavy and the mobile app.

Weavy Setup

Since Azure Notification Hub is the default implemented push notification provider in Weavy, the only thing we have to do is to configure the hubs in the settings. There are two ways of doing this depending if you are running a site locally when developing, or if the site is up and running in the Deployment Manager.

Running the site locally

Add the following to the web.config:

<appSettings>
    <add key="weavy.notification-hub-connection-string" value="[DefaultFullSharedAccessSignature]" />
    <add key="weavy.notification-hub-path" value="[the last part of the hub path]" />
</appSettings>
Replace [DefaultFullSharedAccessSignature] with the connection string you copied in step 3 above. The hub-path is the last part of the Azure Notification Hub path after the last slash (/). For example, in case of a hub named weavynotifications/weavymobile, the hub path you specify in the app setting should be weavymobile.

OPTIONAL:

The default Azure Notification Hub notification provider in Weavy handles different hubs for notifications in the Spaces and the Messenger.
I you want to configure a separate hub for notification sent from the Weavy Messenger, add a new Notification Hub according the the Azure Setup above. Then add the following settings to web.config:
<appSettings>
    <add key="weavy.messenger-notification-hub-connection-string" value="[DefaultFullSharedAccessSignature]" />
    <add key="weavy.messenger-notification-hub-path" value="[the last part of the hub path]" />
</appSettings>

Running the site in the Deployment Manager

If the site is up and running in the Deployment Manager, then you have to update the settings on the site from within the Deployment Manager.

  1. Select the site in the site list
  2. Click on the Settings tab
  3. Update the following settings. If the setting does not exist, then you should add them:
    Setting: weavy.notification-hub-connection-string
    Value: [DefaultFullSharedAccessSignature]

    Setting: weavy.notification-hub-path
    Value: [the last part of the hub path]

Replace [DefaultFullSharedAccessSignature] with the connection string you copied in step 3 above. The hub-path is the last part of the Azure Notification Hub path after the last slash (/). For example, in case of a hub named weavynotifications/weavymobile, the hub path you specify in the app setting should be weavymobile.

OPTIONAL:

The default Azure Notification Hub notification provider in Weavy handles different hubs for notifications in the Spaces and the Messenger.
I you want to configure a separate hub for notification sent from the Weavy Messenger, add a new Notification Hub according the the Azure Setup above. Then add the following settings to the site in the Deployment Manager:

Setting: weavy.messenger-notification-hub-connection-string
Value: [DefaultFullSharedAccessSignature]

Setting: weavy.messenger-notification-hub-path
Value: [the last part of the hub path]

Mobile App Setup

Depending on how you build your app, the registering process is of course a bit different. If you are building the app with Xamarin as the example we provide, you can use the Nuget package Microsoft.Azure.NotificationHubs. Please take a look at the Xamarin.Forms example project on how to get a device token, register with the notification hub and receive a notification. More information on this can also be found here.

Mobile App Setup (Xamarin.Forms example)

Please make sure to read through the instructions on the links above to fully understand the process of setting up a notification hub in Azure. When you are done, you should have a Notification Hub with both Android (GCM/Firebase) and Apple (iOS) credentials set and an Access Policy for the DefaultListenSharedAccessSignature.
Take the access policy connection string and update the Notification\Constants.cs values in each of the platform projects.

Note! The access policy connection string is handled differently in the Android and the iOS project. In the Android project, the whole connection string is specified as the ConnectionString property, but in the iOS project, the connection string is split into a connection string and a shared key.
When you created a new project in Firebase, you should have a google-services.json file that you downloaded. Add (or replace the existing one) in the Android project. Make sure the Build Action is set to GoogleServicesJson. The json file contains all the necessary settings and is automatically merged into the manifest when building the project.

Update the Properties\AndroidManifest.xml file located in the Android project. The

<category android:name="com.comapnyname.app" />
should match the the Android package name that you have specified.

Sending from other providers

Want to use another provider or service to handle push notifications? No problem! Take a look at the Create a Push Notification Provider tutorial to learn more about creating a push notification provider.