Ion equipment does not work after ad serving

Ionic version: 3.x

Current behavior: After registering the equipment, when the ads are displayed, clicking the hardware part exits the application and does not become attached to the normal behavior

Expected Behavior: Hardware must perform registered functions

Steps to play:

  • Create a new application with any addition of a template.
  • Add admob-free plugin
  • Register hardwarback to register something (not for exit).
  • Show ads.
  • Click hardware

Associated Code:

In the constructor app.component.ts, register the inverse handler

platform.registerBackButtonAction(() => { console.log("Back Pressed"); }); 

Show banner ads or interstitial ads, and then without clicking anything in the app, click the back button. The application will exit. We do not exit the application in our handler.

APP REPO HERE .

A related issue can be seen here.

Ion Information:

 cli packages: (C:\Users\prantikv\AppData\Roaming\npm\node_modules) @ionic/cli-utils : 1.12.0 ionic (Ionic CLI) : 3.12.0 global packages: cordova (Cordova CLI) : 7.0.1 local packages: @ionic/app-scripts : 3.0.0 Cordova Platforms : android 6.0.0 Ionic Framework : ionic-angular 3.7.1 System: Android SDK Tools : 25.2.5 Node : v6.11.3 npm : 5.4.2 OS : Windows 10 Misc: backend : pro 
+5
source share
1 answer

Add your addeventlistener to the document and capture the event in the capture phase. When an event stopPropagation , stopPropagation will be useful to prevent other event listeners from starting.

 document.addEventListener("backbutton", onBackKeyDown, true); 
+1
source

Source: https://habr.com/ru/post/1272438/


All Articles