[In-App Messaging] DisplayErrorListener won't be triggered while displaying error in-app messaging.
[READ] Step 1: Are you in the right place?
- Yes
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Hedgehog 2023.1.1 Patch 1
- Firebase Component: In-App Messaging
- Component version: 32.2.3
[REQUIRED] Step 3: Describe the problem
DisplayErrorListener won't trigger while displaying error in-app messaging.
Steps to reproduce:
- Add FirebaseInAppMessagingDisplayErrorListener via FirebaseInAppMessaging.getInstance().addDisplayErrorListener().
- Create a new campaign with a jpeg whose format is unsupported and make it display in the app.
- DisplayErrorListener won't be triggered while displaying error in-app messaging.
What happened? How can we make the problem occur? This could be a description, log/console output, etc.
We found while the function onLoadFailed was accessed, the inAppMessage and displayCallbacks objects are always null.
Hence DisplayErrorListener will never be triggered.
Relevant Code:
@FirebaseAppScope
public class GlideErrorListener implements RequestListener<Object> {
private InAppMessage inAppMessage;
private FirebaseInAppMessagingDisplayCallbacks displayCallbacks;
@Inject
GlideErrorListener() {}
public void setInAppMessage(
InAppMessage inAppMessage, FirebaseInAppMessagingDisplayCallbacks displayCallbacks) {
this.inAppMessage = inAppMessage;
this.displayCallbacks = displayCallbacks;
}
@Override
public boolean onLoadFailed(
@Nullable GlideException e, Object model, Target<Object> target, boolean isFirstResource) {
Logging.logd("Image Downloading Error : " + e.getMessage() + ":" + e.getCause());
if (inAppMessage != null && displayCallbacks != null) {
if (e.getLocalizedMessage().contains("Failed to decode")) {
displayCallbacks.displayErrorEncountered(
FirebaseInAppMessagingDisplayCallbacks.InAppMessagingErrorReason
.IMAGE_UNSUPPORTED_FORMAT);
} else {
displayCallbacks.displayErrorEncountered(
FirebaseInAppMessagingDisplayCallbacks.InAppMessagingErrorReason
.UNSPECIFIED_RENDER_ERROR);
}
}
return false;
}
@Override
public boolean onResourceReady(
Object resource,
Object model,
Target<Object> target,
DataSource dataSource,
boolean isFirstResource) {
Logging.logd("Image Downloading Success : " + resource);
return false;
}
}
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @ione0213, thank you for reaching out. I tried reproducing the issue, however, I’m quite having a trouble with step no 2 you shared.
Create a new campaign with a jpeg whose format is unsupported and make it display in the app.
Can you share with me how you were able to use an unsupported image? If possible, could you share the image you used? Currently, the image URL link must be a valid HTTPS URL. Only .png and .jpg image formats are supported with 3:2 and/or 1:1 aspect ratio.
Aside from that, could you try using the latest SDK version and see if the issue persists? If so, can you share an MCVE or code snippet?
Hi @ione0213, thank you for reaching out. I tried reproducing the issue, however, I’m quite having a trouble with step no 2 you shared.
Create a new campaign with a jpeg whose format is unsupported and make it display in the app.
Can you share with me how you were able to use an unsupported image? If possible, could you share the image you used? Currently, the image URL link must be a valid HTTPS URL. Only .png and .jpg image formats are supported with 3:2 and/or 1:1 aspect ratio.
Aside from that, could you try using the latest SDK version and see if the issue persists? If so, can you share an MCVE or code snippet?
@lehcar09 You can create a non-jpeg file(e.g. .log, .txt, or others...). Modify its' filename extension from .log/.txt/... to .jpg. And upload to the campaign.
We've tried using the latest SDK version(com.google.firebase:firebase-bom:32.7.0).
It's still not working.
Hi @ione0213, thank you for providing the details. I was able to reproduce the issue you reported. With that, I'll inform our engineers and check what we can do here.
The fix has been rolled out on BOM version 32.8.0. Kindly update to version BOM 32.8.0 or latest.
I'll go ahead and close this issue now. If you encounter any issue, you can file new issue with the details to help is investigate the issue. Thanks!