Bug fix: backbutton closes app
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.8-beta-20180314-2331" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.2.8-beta-20180315-1233" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -487,46 +487,6 @@ if (!cordova) {
}, 50);
});
- //--------------------------------------------
- // Hook the backbutton of Android action
- //--------------------------------------------
- var anotherBackbuttonHandler = null;
- function onBackButton(e) {
- common.nextTick(putHtmlElements); // <-- super important!
- if (anotherBackbuttonHandler) {
- // anotherBackbuttonHandler must handle the page moving transaction.
- // The plugin does not take care anymore if another callback is registered.
- anotherBackbuttonHandler(e);
- } else {
- cordova_exec(null, null, 'CordovaGoogleMaps', 'backHistory', []);
- }
- }
- document.addEventListener("backbutton", onBackButton);
-
- var _org_addEventListener = document.addEventListener;
- var _org_removeEventListener = document.removeEventListener;
- document.addEventListener = function(eventName, callback) {
- var args = Array.prototype.slice.call(arguments, 0);
- if (eventName.toLowerCase() !== "backbutton") {
- _org_addEventListener.apply(this, args);
- return;
- }
- if (!anotherBackbuttonHandler) {
- anotherBackbuttonHandler = callback;
- }
- };
- document.removeEventListener = function(eventName, callback) {
- var args = Array.prototype.slice.call(arguments, 0);
- if (eventName.toLowerCase() !== "backbutton") {
- _org_removeEventListener.apply(this, args);
- return;
- }
- if (anotherBackbuttonHandler === callback) {
- anotherBackbuttonHandler = null;
- }
- };
-
-
/*****************************************************************************
* Name space

MODIFY
www/pluginInit.js
www/pluginInit.js
+var cordova_exec = require('cordova/exec');
function pluginInit() {
//-------------------------------------------------------------
// In some older browsers do not implement these methods.
@@ -98,16 +99,65 @@ function pluginInit() {
document.head.appendChild(navDecorBlocker);
- //----------------------------------------------
- // Set transparent mandatory for older browser
- // http://stackoverflow.com/a/3485654/697856
- //----------------------------------------------
- if(document.body){
- document.body.style.backgroundColor = "rgba(0,0,0,0)";
- //document.body.style.display='none';
- document.body.offsetHeight;
- //document.body.style.display='';
+ // I guess no longer necessary this code at 2018/March
+ // //----------------------------------------------
+ // // Set transparent mandatory for older browser
+ // // http://stackoverflow.com/a/3485654/697856
+ // //----------------------------------------------
+ // if(document.body){
+ // document.body.style.backgroundColor = "rgba(0,0,0,0)";
+ // //document.body.style.display='none';
+ // document.body.offsetHeight;
+ // //document.body.style.display='';
+ // }
+
+
+
+ //--------------------------------------------
+ // Hook the backbutton of Android action
+ //--------------------------------------------
+ var anotherBackbuttonHandler = null;
+ function onBackButton(e) {
+
+ cordova.fireDocumentEvent("plugin_touch", {
+ force: true
+ });
+ //common.nextTick(putHtmlElements); // <-- super important!
+
+ if (anotherBackbuttonHandler) {
+ // anotherBackbuttonHandler must handle the page moving transaction.
+ // The plugin does not take care anymore if another callback is registered.
+ anotherBackbuttonHandler(e);
+ } else {
+ cordova_exec(null, null, 'CordovaGoogleMaps', 'backHistory', []);
+ }
}
+
+ document.addEventListener("backbutton", onBackButton);
+
+ var _org_addEventListener = document.addEventListener;
+ var _org_removeEventListener = document.removeEventListener;
+ document.addEventListener = function(eventName, callback) {
+ var args = Array.prototype.slice.call(arguments, 0);
+ if (eventName.toLowerCase() !== "backbutton") {
+ _org_addEventListener.apply(this, args);
+ return;
+ }
+ if (!anotherBackbuttonHandler) {
+ anotherBackbuttonHandler = callback;
+ }
+ };
+ document.removeEventListener = function(eventName, callback) {
+ var args = Array.prototype.slice.call(arguments, 0);
+ if (eventName.toLowerCase() !== "backbutton") {
+ _org_removeEventListener.apply(this, args);
+ return;
+ }
+ if (anotherBackbuttonHandler === callback) {
+ anotherBackbuttonHandler = null;
+ }
+ };
+
}
module.exports = pluginInit;

Bug fix: backbutton closes app #2152