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(messaging, android): Replace deprecated AsyncTask API and other deprecated API #12580
Conversation
…ace with remote message own function
byte[] parcelBytes = | ||
intent.getByteArrayExtra(FlutterFirebaseMessagingUtils.EXTRA_REMOTE_MESSAGE); | ||
if (parcelBytes != null) { | ||
Parcel parcel = Parcel.obtain(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cannot fail? Or it should be part of the try/catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should never fail.
|
||
public void execute() { | ||
executor.execute( | ||
new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we store this runnable to cancel it manually inside cancel()
if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is necessary, it is a like for like replacement for deprecated AsyncTask. The execute(Runnable) is running in the background thread (like doInBackground
for AyncTask). When that work is complete, it calls the processorFinished()
finished on the main thread (like onPostExecute
for AsyncTask). See documentation: https://developer.android.com/reference/android/os/AsyncTask#the-4-steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To add to that, the only time cancel is called using previous AsyncTask, we also call cancel() here using latest implementation: https://github.com/firebase/flutterfire/pull/12580/files#diff-3d9ef1ece89413638d5bc6907c220242d3b2f489db5900782615c504073437f1R561
Description
Done
I tested messages received in open/background/quit and also when opening app with message. Working as intended.
Related Issues
Part of: #8073
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
).This will ensure a smooth and quick review process. Updating the
pubspec.yaml
and changelogs is not required.///
).melos run analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?