How to add plugin hack for inappbrowser in android 7.0.0?

I am working in android version 6.4.0 with ionic 3. But recently I need to go android 7.0.0.
In previous version(6.4.0), I add a plugin edit for InAppBrowser 1.7.2 for close the final payment page after 5 seconds.

I edited the file on path (6.4.0) at /platforms/android/src/org/apache/cordova/inappbrowser/
Edited code is below with added code highlighted with ** (lines 1067 - 1073, line 20)

Code here

But in new android (7.0.0) no file and folder structure exist.
So I try to edit same file named at path /plugins/cordova-plugin-inappbrowser/src/android/

But no closing of final browser on 5 seconds.

How this problem can be fixed ?

please advise


Dear Friends,
As Atif say “Plugin hacking is not a good method of Programming”. I avoid that by ts.
Got the solution by

import it first

import { InAppBrowser, InAppBrowserOptions, InAppBrowserEvent } from “@ionic-native/in-app-browser”;

and relevant code as

  this.platform.ready().then(() => {
  this.payFlag = true;
  var browserRef =,"_blank","hidden=no,location=no,clearsessioncache=yes,clearcache=yes,hardwareback=no");
  browserRef.addEventListener('loadstop', function(e: InAppBrowserEvent) {
  var loc = e.url;
  if(loc == "")
        setTimeout(function () {
        }, 5000);  

Thanks alot