Proposed fix for issue 5593#5597
Merged
VinayGuthal merged 4 commits intofirebase:masterfrom Dec 13, 2023
argzdev:issue5593
Merged
Proposed fix for issue 5593#5597VinayGuthal merged 4 commits intofirebase:masterfrom argzdev:issue5593
VinayGuthal merged 4 commits intofirebase:masterfrom
argzdev:issue5593
Conversation
VinayGuthal
approved these changes
Dec 12, 2023
Contributor
Author
|
Will try to do further testings with Android 14.0. Android 10.0 seems to work alright: Android 14.0 doesn't receive the signal after it finishes downloading: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Possible fix for #5593
Android 14 requires
RECEIVER_EXPORTEDorRECEIVER_NOT_EXPORTEDflag when usingregisterReceivercommand:Currently,
com.google.firebase:firebase-ml-modeldownloader:24.2.1uses theregisterReceiverwithout this flag:firebase-android-sdk/firebase-ml-modeldownloader/src/main/java/com/google/firebase/ml/modeldownloader/internal/ModelFileDownloadService.java
Lines 214 to 215 in ac19e5d
Proposed fix:
An alternative solution is using ContextCompat but requires version 1.9.0 of
androidx.core:core. I noticed in the Android documentation is usingContextCompatfor callingregisterReceiver, or for the flagRECEIVER_EXPORTED&RECEIVER_NOT_EXPORTED:However,
ContextCompat.RECEIVER_NOT_EXPORTEDand theRECEIVER_NOT_EXPORTEDfromcontexthave the same value, so I don't think this is necessary to use ContextCompat.FYI, added
@SuppressLint("WrongConstant")annotation due to the method throwing an error: https://stackoverflow.com/a/74433641