Android Disable Back Button Option
Feature Request
Option to disable the Android hardware back button functionality.
Motivation Behind Feature
I have an app in which I have disabled the back button. I use keycloak-js as my authentication mechanism. When the user starts the authentication process, keycloak-js spawns the inappbrowser. I do not want the user to be able to hit the back button once the inappbrowser has opened.
On iOS, setting "toolbar: no" makes it impossible to go back, but on Android because of the current "harwareback" implementation, this is not possible.
The "hardwareback" option currently allows back to either go back, or close the inappbrowser, neither option are equivalent to the iOS setup where I cannot go back.
Feature Description
Add a new android option for hardwarebackdisabled: yes/no, defaults to no. I suggest a new option since changing the hardwareback would break compatibility,
Alternatives or Workarounds
I have no workarounds at this time.
AS Workaround temporary commented via patch
diff --git a/./platforms/android/app/src/main/java/org/apache/cordova/inappbrowser/InAppBrowserDialog.java b/./platforms/android/app/src/main/java/org/apache/cordova/inappbrowser/InAppBrowserDialog.java
--- a/./platforms/android/app/src/main/java/org/apache/cordova/inappbrowser/InAppBrowserDialog.java
+++ b/./platforms/android/app/src/main/java/org/apache/cordova/inappbrowser/InAppBrowserDialog.java
@@ -49,9 +49,9 @@ public class InAppBrowserDialog extends Dialog {
// because it does a clean up
if (this.inAppBrowser.hardwareBack() && this.inAppBrowser.canGoBack()) {
this.inAppBrowser.goBack();
- } else {
- this.inAppBrowser.closeDialog();
- }
+ //} else {
+ // this.inAppBrowser.closeDialog();
+ //}
}
}
}