I am using FCM Data Messages for pushing Notifications to my Android App. So basically, my data payload will have the information like Notification Title, Message and Image URL. The Image URL will be different for each and every notification. After receiving Data Message from Firebase Messaging Service, I am posting the notification immediately and then doing an additional request for the Image(using AsyncTask). Once the fetch is successful I will update the Notification if it's still Active. Android Blog on how to notify users with FCM
Starting from Android 9, they have made some improvements to Battery-Saver Mode which results in more restrictions. So, On Battery-Saver Mode, the additional requests that I do for fetching Images are failing(SocketTimeOutException) continuously. I have tested this on Pixel and OnePlus 6 and is failing to load Images(during Battery-Saver Mode) on both the devices.
I tried doing the additional requests using the Work Manager/Job Scheduler and had no success.
And my App doesn't fall under acceptable use-cases for whitelisting(Battery Optimization Exceptions).
Is there any other way to successfully load images in the background for a Notification? Any help would be highly appreciated. Thanks.