diff --git a/nativescript-core/utils/native-helper.android.ts b/nativescript-core/utils/native-helper.android.ts index 06c9cee04..ce1709fbd 100644 --- a/nativescript-core/utils/native-helper.android.ts +++ b/nativescript-core/utils/native-helper.android.ts @@ -62,6 +62,9 @@ export module ad { let windowToken: android.os.IBinder; if (nativeView instanceof android.view.View) { + if (!nativeView.hasFocus()) { + return; + } windowToken = nativeView.getWindowToken(); } else if (androidApp.foregroundActivity instanceof androidx.appcompat.app.AppCompatActivity) { const decorView = androidApp.foregroundActivity.getWindow().getDecorView(); @@ -159,4 +162,4 @@ export module ad { return fingerprint != null && (fingerprint.indexOf("vbox") > -1 || fingerprint.indexOf("generic") > -1); } -} \ No newline at end of file +}