[IMA-SDK Android] An error occurs when trying to open the ad link in a custom tab

110 views
Skip to first unread message

pineapplevine1

unread,
Oct 21, 2025, 2:46:05 AMOct 21
to Interactive Media Ads SDK
Hi IMA Team

We are developing a library that customizes Media3 and wraps the IMA SDK APIs, so that the app invokes the IMA SDK APIs through the library’s API.
Currently, with that implementation, when we call setEnableCustomTabs(true)—an IMA SDK API—and try to open an ad’s landing page in a custom tab, we encounter an Intent-related error.

> android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

If you have any ideas about the cause of this issue or possible workarounds, please let us know.

Best Regards.

IMA SDK

unread,
Oct 21, 2025, 10:26:34 AMOct 21
to pineapp...@gmail.com, ima...@googlegroups.com

Hi,

Thank you for reaching out to the IMA SDK Support team.

The behavior you are experiencing when starting an Activity from a non-Activity context such as a Fragment is expected, as outlined in the documentation. You can try adding Intent.FLAG_ACTIVITY_NEW_TASK to your startActivity() call to see if that resolves the issue.Additionally, if you're using an older version of the SDK, we recommend updating to the latest version.

If the problem persists, please share the following details so we can investigate further.

  • Sample project reproducing the issue
  • Steps to replicate the issue
  • Affected device information

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to

https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=500Ht00001vRLwJIAW&entry.80707362=00336063

2. Fill out all fields, and attach your file(s).

3. Please reply back to this thread when you have uploaded your file(s). Please do not share this link.
Thanks,

 
Google Logo IMA SDK Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-10-21 14:26:25Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



pineapplevine1

unread,
Oct 22, 2025, 5:39:33 AMOct 22
to Interactive Media Ads SDK
Hi IMA Team

The startActivity() mentioned in the error message is not being called by our app or by our library that customizes Media3. We believe it is triggered by an Intent sent by the IMA SDK when the “Learn more” in the ad is tapped to open the link. Therefore, if FLAG_ACTIVITY_NEW_TASK is to be added, it would need to be handled within the IMA SDK’s processing.

Best Regards.

2025年10月21日火曜日 23:26:34 UTC+9 IMA SDK:

IMA SDK

unread,
Oct 22, 2025, 10:39:33 AMOct 22
to pineapp...@gmail.com, ima...@googlegroups.com

Hi,

Thank you for getting back to us.

As mentioned earlier, could you please share the following details via reply to author option? This will help us continue our investigation.

    • Sample project reproducing the issue
    • VAST tag with learn more option
    • Affected device information
    If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

    1. Navigate to

    https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=500Ht00001vRLwJIAW&entry.80707362=00336063

    2. Fill out all fields, and attach your file(s).

    3. Please reply back to this thread when you have uploaded your file(s). Please do not share this link.

    Thanks,
     
    Google Logo IMA SDK Team

    Feedback
    How was our support today?

    rating1    rating2    rating3    rating4    rating5

    [2025-10-22 14:39:22Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



    IMA SDK

    unread,
    Oct 30, 2025, 11:28:56 AM (13 days ago) Oct 30
    to pineapp...@gmail.com, ima...@googlegroups.com
    Hi,
     
    Thank you for contacting the Mobile Ads SDK Support team.

    I will investigate your issue and get back to you shortly.

    Thanks,
     
    Google Logo IMA SDK Team

    Feedback
    How was our support today?

    rating1    rating2    rating3    rating4    rating5

    [2025-10-30 15:28:48Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



    IMA SDK

    unread,
    Nov 3, 2025, 6:08:02 AM (9 days ago) Nov 3
    to pineapp...@gmail.com, ima...@googlegroups.com

    Hi,

    Kindly apologies for the delay.

    I have reviewed the provided sample project and was able to reproduce the crash. The crash occurs because setEnableCustomTabs(true) is being called inside the setupAdsRendering method. This call should be made within the onAdsManagerLoaded method, and the adsRenderingSettings object should be defined as a global variable.

    I hope this helps! Let me know if you have any other questions.


    Thanks,
     
    Google Logo IMA SDK Team

    Feedback
    How was our support today?

    rating1    rating2    rating3    rating4    rating5

    [2025-11-03 11:07:52Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



    pineapplevine1

    unread,
    Nov 6, 2025, 2:24:09 AM (6 days ago) Nov 6
    to Interactive Media Ads SDK
    Hi IMA Team

    Based on your feedback, I have edited the sample project that I provided previously.
    I changed the timing of the setEnableCustomTabs(true) call to onAdsManagerLoaded, and modified adsRenderingSettings to be a global variable. I tested the changes, but the situation has not improved.
    Has the issue been resolved on your side?
    I would like to confirm whether there is any discrepancy in our understanding of the modification method.

    Best Regards.

    2025年11月3日月曜日 20:08:02 UTC+9 IMA SDK:

    IMA SDK

    unread,
    Nov 6, 2025, 7:46:16 AM (6 days ago) Nov 6
    to pineapp...@gmail.com, ima...@googlegroups.com

    Hi,

    Thanks for getting back to us.

    We have identified a change needed in the AdTagLoader class within the lib-exoplayer-ima module to address the crash issue. Currently, the line adsRenderingSettings.setEnableCustomTabs(true) is placed inside the setupAdsRendering() method (around line 627). This line should be removed from this method. Instead, set the setEnableCustomTabs(true) property inside the onAdsManagerLoaded() method (around line 1418) of the same class, as shown below:

    AdsRenderingSettings adsRenderingSettings = imaFactory.createAdsRenderingSettings();
    adsRenderingSettings.setEnableCustomTabs(true);

    After applying the above changes, I tested the implementation and the crash no longer occurs. Please try these modifications on your end as well, and if the issue still persists, kindly share an updated sample project for further analysis.

    If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

    1. Navigate to

    https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=IMA+SDK&entry.460850823=500Ht00001vRLwJIAW&entry.80707362=00336063

    2. Fill out all fields, and attach your file(s).

    3. Please reply back to this thread when you have uploaded your file(s). Please do not share this link.

    Thanks,
     
    Google Logo IMA SDK Team

    Feedback
    How was our support today?

    rating1    rating2    rating3    rating4    rating5

    [2025-11-06 12:46:08Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



    pineapplevine1

    unread,
    Nov 7, 2025, 3:36:12 AM (5 days ago) Nov 7
    to Interactive Media Ads SDK
    Hi IMA Team

    I have applied the changes you suggested and performed a functionality check.
    It no longer crashes, but the configuration for setEnableCustomTabs(true) is not taking effect, and when tapping “Learn more,” the link opens in a web browser.
    The expected behavior when setEnableCustomTabs(true) is set is that the link should open in the app's custom tab instead of in the web browser.

    Best Regards.

    2025年11月6日木曜日 21:46:16 UTC+9 IMA SDK:

    IMA SDK

    unread,
    Nov 7, 2025, 10:20:56 AM (5 days ago) Nov 7
    to pineapp...@gmail.com, ima...@googlegroups.com

    Hi,

    I will raise this issue to the wider team. Once we receive any updates, we will intimate you. Meanwhile, your patience is important. 


    Thanks,
     
    Google Logo IMA SDK Team

    Feedback
    How was our support today?

    rating1    rating2    rating3    rating4    rating5

    [2025-11-07 15:20:47Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01vRLwJ:ref" (ADR-00336063)



    Reply all
    Reply to author
    Forward
    0 new messages