Skip to content

Commit

Permalink
feat/Version update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaela-dev committed Mar 7, 2022
1 parent 830240f commit 78d3412
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SDK is created as .net wrapper for binding libraries of [native Android SDK](htt
* [iOS push notifications](./documentation/IOS_PUSH.md)
* [Android univerzal links](./documentation/ANDROID_UNIVERZAL_LINKS.md)
* [iOS univerzal links](./documentation/IOS_UNIVERSAL_LINKS.md)
* [Necessary changes between major versions](./documentation/VERSION_UPDATE.md)

## Release Notes

Expand Down
46 changes: 46 additions & 0 deletions documentation/VERSION_UPDATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Version update

This guide will help you upgrade your Exponea SDK to the new version.

## Updating from version 0.x.x to 1.x.x
Changes you will need to do when updating Exponea SDK to version 1 and higher are related to firebase push notifications.

### Changes regarding FirebaseMessagingService

We decided not to include the implementation of FirebaseMessagingService in our SDK since we want to keep it as small as possible and avoid including the libraries that are not essential for its functionality. SDK no longer has a dependency on the firebase library. If you relied on our FirebaseMessagingService, instead of using yours, changes you need to do are as follows:

1. You will need to implement FirebaseMessagingService on your application side.
2. Call `ExponeaNotificationHandler.Instance.HandleRemoteMessage` when a message is received
3. Call `ExponeaNotificationHandler.Instance.HandleNewToken` when a token is obtained
4. Register this service in your `AndroidManifest.xml` (3 lines before class definition in following example code)

```csharp
...
using Exponea.Android;
using Firebase.Messaging;

namespace YourNameSpace
{
[Service(Name = "yournamespace.ExampleFirebaseMessageService", Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
[IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })]
public class ExampleFirebaseMessageService : FirebaseMessagingService {

public override void OnMessageReceived(RemoteMessage message)
{
var notificationManager = (NotificationManager)GetSystemService(NotificationService);
if (!ExponeaNotificationHandler.Instance.HandleRemoteMessage(ApplicationContext, message.Data, notificationManager, true))
{
// push notification is from another push provider
}
}

public override void OnNewToken(string token)
{
ExponeaNotificationHandler.Instance.HandleNewToken(ApplicationContext, token);
}
}
}
```
If you are already using your own FirebaseMessagingService and calling our SDK method in it, just a slight change will be needed.
You will need to change the second parameter when calling the `HandleRemoteMessage` method. Before, SDK accepted the firebase message as the second parameter, but since we removed Firebase dependency, IDictionary<string, string> should be used now. You can get the message data dictionary from Firebase RemoteMessage by calling remoteMessageInstance.Data.

0 comments on commit 78d3412

Please sign in to comment.