von: Anonym
Re: Multi Window für Osmand und Forumslander - 01.11.17 13:19
In Antwort auf: Streckenplanverweigerer
Die App-Energieüberwachung hatte ich generell noch nicht aktiviert.
Die Ursache liegt definitiv im Multiwindow-Lifecycle onPause!
Da Osmand OpenSource ist, trau ich mich hier auch den Code dafür zu posten.
Auch wenn man keine Java-Kenntnisse hat, kann man anhand der Funktionsnamen erahnen, was da alles abgeschaltet wird, wenn Osmand in die Pause geht:
Code:
@Override protected void onPause() { mapView.setOnDrawMapListener(null); cancelSplashScreenTimer(); app.getMapMarkersHelper().removeListener(this); app.getRoutingHelper().removeListener(this); app.getDownloadThread().resetUiActivity(this); if (atlasMapRendererView != null) { atlasMapRendererView.handleOnPause(); } super.onPause(); app.getLocationProvider().pauseAllUpdates(); app.getDaynightHelper().stopSensorIfNeeded(); settings.APPLICATION_MODE.removeListener(applicationModeListener); settings.setLastKnownMapLocation((float) mapView.getLatitude(), (float) mapView.getLongitude()); AnimateDraggingMapThread animatedThread = mapView.getAnimatedDraggingThread(); if (animatedThread.isAnimating() && animatedThread.getTargetIntZoom() != 0) { settings.setMapLocationToShow(animatedThread.getTargetLatitude(), animatedThread.getTargetLongitude(), animatedThread.getTargetIntZoom()); } settings.setLastKnownMapZoom(mapView.getZoom()); settings.MAP_ACTIVITY_ENABLED.set(false); getMyApplication().getAppCustomization().pauseActivity(MapActivity.class); app.getResourceManager().interruptRendering(); OsmandPlugin.onMapActivityPause(this); }