tonyofrancis / Fetch

The best file downloader library for Android
https://www.meta.stackoverflow.com/tags/fetch2
Apache License 2.0
1.63k stars 328 forks source link

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. #638

Open ryancode-commit opened 2 years ago

ryancode-commit commented 2 years ago

Fetch there is an error in compileSdkVersion 31 and above & targetSdkVersion 31 and above because DefaultFetchNotificationManager there is a Pending intent with Flag_current_update

557711 commented 2 years ago

Kindly Solve this issuse Owner of library

shreyaag1 commented 1 year ago

Please update the library!

OmidNejadabbasi commented 1 year ago

@shreyaag1 @ryancode-commit @557711

I managed to fix the bug by copying and pasting the code into my own class file and corrected the PendingIntent flag. Here is the link to my code : https://gist.github.com/OmidNejadabbasi/ccda264acc68a65be6004199344d168f

Remember that you should instantiate and pass this object to setNotificationManager() method.

sanjaysingh1990 commented 1 year ago

Thank you for this fix

ryancode-commit commented 1 year ago

@shreyaag1 @ryancode-commit @557711

I managed to fix the bug by copying and pasting the code into my own class file and corrected the PendingIntent flag. Here is the link to my code : https://gist.github.com/OmidNejadabbasi/ccda264acc68a65be6004199344d168f

Remember that you should instantiate and pass this object to setNotificationManager() method.

I can't paste it Make a new class or edit DefaultFetchNotigicationManager?

OmidNejadabbasi commented 1 year ago

@shreyaag1 @ryancode-commit @557711 I managed to fix the bug by copying and pasting the code into my own class file and corrected the PendingIntent flag. Here is the link to my code : https://gist.github.com/OmidNejadabbasi/ccda264acc68a65be6004199344d168f Remember that you should instantiate and pass this object to setNotificationManager() method.

I can't paste it Make a new class or edit DefaultFetchNotigicationManager?

Yes, you should create your own .java file and paste my code and then use that class. I have tested it and it works!

sanjaysingh1990 commented 1 year ago

This fix worked for me as well after some fixes like string and drawable resources linking.

ryancode-commit commented 1 year ago

@shreyaag1 @ryancode-commit @557711 I managed to fix the bug by copying and pasting the code into my own class file and corrected the PendingIntent flag. Here is the link to my code : https://gist.github.com/OmidNejadabbasi/ccda264acc68a65be6004199344d168f Remember that you should instantiate and pass this object to setNotificationManager() method.

I can't paste it Make a new class or edit DefaultFetchNotigicationManager?

Yes, you should create your own .java file and paste my code and then use that class. I have tested it and it works!

For import net.omidn.fetchme.R.drawable and import net.omidn.fetchme.R.string Do you use library? Or what?

sanjaysingh1990 commented 1 year ago

replace these drawable and string resources with your local resources.

ryancode-commit commented 1 year ago

Thank you so much.