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_EXPORTED
orRECEIVER_NOT_EXPORTED
flag when usingregisterReceiver
command:Currently,
com.google.firebase:firebase-ml-modeldownloader:24.2.1
uses theregisterReceiver
without 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 usingContextCompat
for callingregisterReceiver
, or for the flagRECEIVER_EXPORTED
&RECEIVER_NOT_EXPORTED
:However,
ContextCompat.RECEIVER_NOT_EXPORTED
and theRECEIVER_NOT_EXPORTED
fromcontext
have 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