H5 页面

H5 页面

H5 页面请求后,在新界面中加载其他 H5 插件

请求 H5 页面

调用ZJAndroid.h5Page方法请求 H5 页面

class ZJAndroid {
  /// H5页面
  static void h5Page(

      /// 广告位ID
      String posId,

      /// 用户ID,必填
      String userId, {
        /// 回调。具体事件见 example
        Function(ZJEvent ret)? h5PageListener,
      });
}

H5 页面回调说明

ret.action说明
ZJEventAction.onAdError广告展示失败
ret.code:错误码,非错误事件为0
ret.msg:错误信息,非错误事件为空字符串
ZJEventAction.onAdClose广告关闭

H5 页面接入示例

example/lib/h5_page.dart
/// 加载并展示插屏广告
void _h5Page(String posId) {
  ZJAndroid.h5Page(
      // 广告位ID
      posId,
      // 用户ID,必填
      TestPosId.testUserId,
      h5PageListener: (ret) {
        switch (ret.action) {
          case ZJEventAction.onAdError:
            Fluttertoast.showToast(msg: "H5页面错误:${ret.msg}");
            if (kDebugMode) {
              print("${ret.action}:${ret.code}-${ret.msg}");
            }
            break;
          case ZJEventAction.onAdClose:
            Fluttertoast.showToast(msg: "H5页面关闭");
            break;
          default:
            // ignore
        }
      }
  );
}