Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the FCM token with this plugin #7

Open
Easycatchup opened this issue Oct 18, 2020 · 1 comment
Open

Using the FCM token with this plugin #7

Easycatchup opened this issue Oct 18, 2020 · 1 comment

Comments

@Easycatchup
Copy link

Hi,
I'm trying to use this plugin as described in
firebase/flutterfire#116 (comment)
to send IOS background notifications on IOS but I always get the "BadDeviceToken" error server-side, my guess is that I did not correctly register the token.

I am trying to use the same token as FCM - in general push notifications work fine for me using FCM both on Android and IOS, it's really just IOS background notifications that do not work where I would need this plugin.

Could someone who successfully implemented it share the code on the flutter side to use the same token for FCM and this plugin in a stateless widget?

Thanks,
Marcel

@VictorUvarov
Copy link

VictorUvarov commented Apr 5, 2021

Push notification tokens are not the same as voip notification tokens. They need to be managed seperatley in your database.

Here is an example of using it with curl. You can probably do something similar with FCM

curl -v \
-d '{"aps":{"alert":{"uuid":"982cf533-7b1b-4cf6-a6e0-004aab68c503","incoming_caller_id":"0123456789","incoming_caller_name":"Tester"}}}' \
-H "apns-push-type: voip" \
-H "apns-expiration: 0" \
-H "apns-priority: 0" \
-H "apns-topic: <your app’s bundle ID>.voip" \
--http2 \
--cert ./voip_services.pem \
https://api.sandbox.push.apple.com/3/device/<VoIP device Token for your iPhone>

From Apple docs:

Use the voip push type for notifications that provide information about an incoming Voice-over-IP (VoIP) call. For more information, see Responding to VoIP Notifications from PushKit.

If you set this push type, the apns-topic header field must use your app’s bundle ID with .voip appended to the end. If you’re using certificate-based authentication, you must also register the certificate for VoIP services. The topic is then part of the 1.2.840.113635.100.6.3.4 or 1.2.840.113635.100.6.3.6 extension.

The voip push type is not available on watchOS. It is recommended on macOS, iOS, tvOS, and iPadOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants