Skip to content

Plugin throws error when trying to show reward video #2

@Chbe

Description

@Chbe

Only tested on Android and with RewardVideos but my guess is that the same problem is with showInterstitial function.

isLoaded must be called on the main UI thread is thrown when calling showRewardVideoAd().

@PluginMethod() public void showRewardVideoAd(PluginCall call) { try { if (mRewardedVideoAd.isLoaded()) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { mRewardedVideoAd.show(); } }); call.success(new JSObject().put("value", true)); }else { call.error("The RewardedVideoAd wasn't loaded yet."); } }catch (Exception ex) { call.error(ex.getLocalizedMessage(), ex); } }

Maybe its possible to wrap isLoaded within a new Runnable and setting the PluginCall call to final to access the param? Or having a new method that returns mRewardedVideoAd.isLoaded(), that could be useful in more cases probably.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions