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.
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
in the Create a Push Notification Provider tutorial.
Sending push notifications from Azure Notification Hubs is the default implementation in Weavy.
In Azure Portal, do the following:
- Create a new Notification Hub. Select the Free pricing tier for this purpose.
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
- On Access Policies, copy the DefaultListenSharedAccessSignature and the DefaultFullSharedAccessSignature for later use when setting up Weavy and the mobile app.
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 deployed via the Tenant SDK.
Running the site locally
Add the following to the web.config:
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.
<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>
<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 Tenant SDK
If the site is up and running in the Tenant SDK, then you have to update the settings on the site from within the Tenant Dashboard (or optionally via the Tenant API).
- Select the site in the site list
- Click on the Settings tab
Update the following settings. If the setting does not exist, then you should add them:
Value: [the last part of the 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.
google-services.jsonfile 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.
Properties\AndroidManifest.xml file located in the Android project. The
should match the the Android package name that you have specified.
<category android:name="com.comapnyname.app" />
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.