阻止用户关闭插页式广告几秒钟

时间:2017-07-07 05:03:39

标签: android delphi admob interstitial delphi-10.1-berlin

可以阻止用户关闭AdMob中的插页式广告几秒钟? Google向我的插页式广告发送了几个广告,这些广告显示了关闭广告的3-2-1计时器,但当用户点击后退广告时,该广告立即关闭。

type
TMyAdViewListener = class(TJavaLocal, JIAdListener)
private
FAD: JInterstitialAd;
public
constructor Create(AAD: JInterstitialAd);
procedure onAdClosed; cdecl;
procedure onAdFailedToLoad(errorCode: Integer); cdecl;
procedure onAdLeftApplication; cdecl;
procedure onAdOpened; cdecl;
procedure onAdLoaded; cdecl;
end;

private
LAdViewListener: TMyAdViewListener;
FInterStitial: JInterstitialAd;

var
  LADRequestBuilder: JAdRequest_Builder;
  LadRequest: JAdRequest;

procedure TForm53.FormCreate(Sender: TObject);
begin
FInterStitial := TJInterstitialAd.JavaClass.init(MainActivity);
FInterStitial.setAdUnitId
(StringToJString('ca-app-pub-1212/1212'));
end;

constructor TMyAdViewListener.Create(AAD: JInterstitialAd);
begin
inherited Create;
FAD := AAD;
end;

在任何TMyAdViewListener事件中都没有进行任何操作

LADRequestBuilder := TJAdRequest_Builder.Create;
LADRequestBuilder.setGender(genero);
LADRequestBuilder.addTestDevice(MainActivity.getDeviceID);
LadRequest := LADRequestBuilder.build();
LAdViewListener := TMyAdViewListener.Create(FInterStitial);
CallInUIThread(
procedure
begin
  FInterStitial.setAdListener(TJAdListenerAdapter.JavaClass.init
    (LAdViewListener));
  FInterStitial.loadAd(LadRequest);
end);

最后,过了一段时间才显示出来......

CallInUIThread(
procedure
begin
  LAdViewListener.FAD.show;
end);

但即使设置if((Key = vkHardwareBack))然后Key:= 0;在主要广告和调用广告的表单上,广告会忽略它并关闭自己。

有什么方法可以阻止广告关闭几秒钟或几个Back taps?

0 个答案:

没有答案