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

Fix Firebase Messaging 22.0.0 Compatibility for 3.x.x branch #1348

Merged
merged 5 commits into from
May 27, 2021

Conversation

jkasten2
Copy link
Member

@jkasten2 jkasten2 commented May 26, 2021

Description

One Line Summary

Same as PR #1340 expect for this 3.x.x branch to back port.

Details

First 3 commits were cherry picked from the master branch version of this PR. However instead of using reflection on the old firebase-messaging API we had to write new code to use reflection on the new API. This is due to the fact we can't upgrade firebase-messaging on this 3.x.x patch branch as it would introduce a dependency on AndroidX.

This change is Reviewable

* Move the implementation of getToken into it's own method.
   - Allows us to add another implementation in a follow up commit
* New getTokenWithClassFirebaseMessaging method that uses the newer
FirebaseMessaging.getToken() API added in firebase-messaging:21.0.0.
* Since all apps may not have updated to firebase-messaging:21.0.0 or
newer we are catching NoClassDefFoundError & NoSuchMethodError
and falling back to FirebaseInstanceId.getToken
@jkasten2 jkasten2 added the WIP Work In Progress label May 26, 2021
* Since we can't bump firebase-messaging high enougth to get the
FirebaseMessaging.getToken method compile with we are instead calling
it with reflection.
* We can't bump any higher as this would interduce AndroidX which
would interduce breaking changes we can't do on this 3.x.x branch.
* Older versions of firebase-messaging such as 19 have this method but
will return null.
@jkasten2 jkasten2 removed the WIP Work In Progress label May 26, 2021
@jkasten2 jkasten2 requested a review from Jeasmine May 26, 2021 06:07
@jkasten2 jkasten2 merged commit 3515ae9 into sdk_3.X.X May 27, 2021
@jkasten2 jkasten2 deleted the fix/firebase-messaging-22.0.0_compat_for_3.x.x branch May 27, 2021 05:46
@jkasten2 jkasten2 mentioned this pull request Jun 3, 2021
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

Successfully merging this pull request may close these issues.

2 participants