Skip to content

Commit 405778c

Browse files
2 parents db97dcc + ebbf500 commit 405778c

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

docs/configure-notifo-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can find your Firebase Service Account Details under the "Service accounts"
1010
![Firebase Service Account Details](media/firebase-service-account-details.png)
1111

1212
### **2. Add Firebase Project ID, and Service Account Details to Notifo**
13-
In Notifo go to More -> Settings and paste your Project ID and Service Account Details in the appropriate fields and click Save.
13+
In Notifo go to More -> Integrations -> Firebase and paste your Project ID and Credentials in the appropriate fields and click Save.
1414

1515
![Notifo Firebase Settings](media/notifo-settings.png)
1616

docs/offline-device-handling.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Handling notifications while a device is offline or airplane mode
22

3-
### The problem
4-
5-
Currently, Notifo supports only firebase [notification](https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages) messages that are [always collapsible](https://firebase.google.com/docs/cloud-messaging/concept-options#collapsible_and_non-collapsible_messages) and if we send multiple notifications to a device while it is offline, only the most recent notification will show when the device comes back online.
6-
7-
### Possible solution
8-
9-
For Android the solution is pretty easy, we just need to extend Notifo to be able to send firebase [data](https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages) messages, which are non-collapsible by default and have a [default time-to-live period](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/#androidconfig) of four weeks (probably we need to reduce this), so we can receive all offline messages. But for iOS Apple will only store the most recent notification sent to a device on the [APNs servers](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW5). So turns out for iOS we need a completely different custom solution.
3+
For Android the solution is pretty easy, Notifo is able to send firebase [data](https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages) messages, which are non-collapsible by default and have a [default time-to-live period](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/#androidconfig) of four weeks, so we can receive all offline messages. But for iOS Apple will only store the most recent notification sent to a device on the [APNs servers](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW5). So turns out for iOS we need a completely different custom solution.
104

115
First, we need to send different types of messages for Android and iOS. Android will need data messages and iOS will need notification messages. It is because iOS will treat data messages as [silent](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app) messages and Apple [does not guarantee](https://firebase.google.com/docs/cloud-messaging/ios/receive#handle_silent_push_notifications) the delivery of silent messages and put other restrictions on them.
126

@@ -30,16 +24,20 @@ In order to send platform-specific message payload, we need to use [Firebase HTT
3024
"body": "Body iOS"
3125
},
3226
"mutable-content": 1
33-
},
34-
"notification-id": "unique-id"
27+
}
3528
}
3629
}
3730
}
3831
}
3932
```
4033

41-
Second, when the last notification gets delivered after the device will back online we will send a delivery report to Notifo backend of that notification with a unique notification ID, then the backend will check for all the notifications that were not delivered and will send them again (that should be done only for iOS devices, so seems that we need to somehow distinguish between platforms, maybe send platform name together with device token).
34+
Second, when the last notification gets delivered after the device will back online we will send a delivery report to Notifo backend using a unique `trackingUrl`, then the Notifo backend will schedule a background/silent notification to wakeup the iOS device (no more than once per 30 minutes). This background notification will initiate fetch and show pending offline notifications as local notifications on the iOS device.
35+
36+
### Notification Service Extension
37+
Apple doesn’t provide any official method to know when a Push Notification has been delivered to the user’s device. We are using [UNNotificationServiceExtension](https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension) for that purposes. It turns out to be a viable solution, the only limitation is we have 30 seconds to send the delivery report to Notifo backend, but that feels more than enough. For this solution, there is included `mutable-content` parameter in the payload example above.
4238

43-
Unfortunately, Apple doesn’t provide any official method to know when a Push Notification has delivered to the user’s device. But seems like [UNNotificationServiceExtension](https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension) is a viable solution, the only limitation is we have 30 seconds to send the delivery report to Notifo backend, but that feels more than enough. For this solution, there are included “mutable-content” and “notification-id” parameters in the payload example above.
39+
### App groups
40+
For tracking/storing delivered notifications locally we are using `Xamarin.Essentials.Preferences` (that uses iOS `UserDefaults` on the iOS platform). In order to be able to share data between a host app and its app extension, we need to configure an [app group capability](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups).
41+
Name convetion for app group is `group.{app-bundle-id}.notifo`.
4442

4543

docs/release-nuget.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ We use [Github Actions](https://docs.github.com/en/actions) to release NuGet pac
1313
* v1.0.0
1414
* v0.0.1-alpha1
1515
*(Note: suffix **-alpha**, **-beta** will publish [pre-release](https://docs.microsoft.com/en-us/nuget/concepts/package-versioning#pre-release-versions) version of NuGet package.)*
16-
![Releases tagged version](https://help.github.com/assets/images/help/releases/releases-tag-version.png)
16+
![Releases tagged version](https://docs.github.com/assets/cb-40521/images/help/releases/releases-tag-create-confirm.png)
1717
* Type a title and description for your release.
18-
![Releases description](https://help.github.com/assets/images/help/releases/releases_description.png)
18+
![Releases description](https://docs.github.com/assets/cb-15127/images/help/releases/releases_description_auto.png)
1919
* To notify users that the release is not ready for production and may be unstable, select **This is a pre-release**.
2020
![Checkbox to mark a release as prerelease](https://help.github.com/assets/images/help/releases/prerelease_checkbox.png)
2121
* Click **Publish release**. It will trigger the workflow in [publish.yml](https://github.com/notifo-io/sdk-xamarin/blob/master/.github/workflows/publish.yml) and after a few minutes, the new release should be available in [nuget.org](https://www.nuget.org/packages?q=Notifo).

0 commit comments

Comments
 (0)