(Android) update: prevent ANR
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.3.0-exp-20180130" 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.3-beta-20180201-1408" 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
src/android/plugin/google/maps/MyPluginLayout.java
src/android/plugin/google/maps/MyPluginLayout.java
@@ -237,9 +237,29 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
*/
scrollView.setHorizontalScrollBarEnabled(false);
scrollView.setVerticalScrollBarEnabled(false);
+ startTimer();
+ }
+
+ public void stopTimer() {
+ try {
+ redrawTimer.cancel();
+ redrawTimer.purge();
+ timerLock.notify();
+ } catch (Exception e) {}
+ redrawTimer = null;
+ }
+
+ public void startTimer() {
+ if (redrawTimer != null) {
+ return;
+ }
+ try {
+ timerLock.notify();
+ } catch (Exception e) {}
+
redrawTimer = new Timer();
- redrawTimer.scheduleAtFixedRate(new ResizeTask(), 100, 25);
+ redrawTimer.scheduleAtFixedRate(new ResizeTask(), 0, 25);
mActivity.getWindow().getDecorView().requestFocus();
}

MODIFY
src/android/plugin/google/maps/PluginMap.java
src/android/plugin/google/maps/PluginMap.java
@@ -445,8 +445,10 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
if (mapView != null) {
mapView.onPause();
}
+ mapCtrl.mPluginLayout.stopTimer();
mapCtrl.mPluginLayout.removePluginMap(this.mapId);
+
}
@Override
public void onResume(boolean multitasking) {
@@ -455,6 +457,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
mapView.onResume();
}
mapCtrl.mPluginLayout.addPluginMap(PluginMap.this);
+ mapCtrl.mPluginLayout.startTimer();
}
private class AdjustInitCamera implements Runnable {

(Android) update: prevent ANR #2041