chore: Migrate from Push Subscriptions to FCM Integration #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FCM Integration
In this PR the old
push_subscription
logic is replaced by the newmobile_push/fcm
channel.To get this to work I had to update the SDK and the example app.
In the SDK I refactored the
com.magicbell.sdk.feature.pushsubscription
intocom.magicbell.sdk.feature.fcmtoken
.In the example I've updated:
askNotificationPermission
function andupdateDeviceToken
functionTest Plan
I've registered an app with the
com.magicbell.example
package in the firebase console and added the resultinggoogle-services.json
file to the android project (atexample/google-services.json
).I then exported the service account private key and registered it with magicbell by sending a PUT to
/integrations/fcm
.Now when the app is launched the token registration can be observed in Proxyman:
When calling the
disconnectUser(...)
function the token is successfully removed:While the token is registered a push notifications arrive on the device:
The data of the notification message can be handled in
onMessageReceived
:message.data
constains custom values and action URLmessage.notification.title
andmessage.notification.body
contain title and body