mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 918 forks source link

App works slow after initializing the map on Android #261

Closed starostin closed 10 years ago

starostin commented 10 years ago

Hello. I have some problem in Android. After initializing map my application starts work very slow. All css animations and transactions. On version 1.1.2 everything was ok, but on 1.2.2 it is happened. Is there any solution? I have tried to remove the map each time, when I detach the view, but it does not help( Can you suggest anything, please

wf9a5m75 commented 10 years ago

Some people reports similar this case, but I can not reproduce the same issue. I think the webview(browser view) of Android is related with this issue. What Android device and Android version do you use? Could you show me the screen capture of "system settings > About phone"?

starostin commented 10 years ago

Nexus 7 2, android 4.4.4. Weird that on old version everything worked well

starostin commented 10 years ago

And on Nexus 7 some transitions even does not work at all (

wf9a5m75 commented 10 years ago

Um, that's weird. I usually tested on Nexus 7 (2012), but there is no issue. Do you use any other plugin with this plugin?

wf9a5m75 commented 10 years ago

And do you use the ionic framework or something?

starostin commented 10 years ago

I use a lot plugins, we develop a big app. No, I don't use ionic. We use backbone

wf9a5m75 commented 10 years ago

Could you tell me what plugins do you use?

starostin commented 10 years ago

Is the reason could be in other phonegap plugins?

starostin commented 10 years ago

android.support.v4 1.0.0 "Android Support v4" co.themobilefirm.FlurryPlugin 3.3.6 "Flurry SDK" com.google.playservices 17.0.0 "Google Play Services for Android" com.googlemaps.ios 1.8.1 "Google Map iOS SDK for Cordova" com.jcesarmobile.IDFVPlugin 1.0.0 "Identifier For Vendor Plugin" com.phonegap.plugins.PushPlugin 2.2.0 "PushPlugin" com.phonegap.plugins.sqlite 0.7.0 "SQLitePlugin" com.phonegap.plugins.videoplayer 1.0 "VideoPlayer" com.plugin.datepicker 0.3.0 "Datepicker" de.appplant.cordova.plugin.email-composer 0.8.2dev "EmailComposer" nl.x-services.plugins.calendar 4.2.3 "Calendar" org.apache.cordova.camera 0.2.9 "Camera" org.apache.cordova.console 0.2.8 "Console" org.apache.cordova.device 0.2.9 "Device" org.apache.cordova.file 1.0.1 "File" org.apache.cordova.file-transfer 0.4.2 "File Transfer" org.apache.cordova.geolocation 0.3.10 "Geolocation" org.apache.cordova.network-information 0.2.10-dev "Network Information" org.apache.cordova.splashscreen 0.3.1 "Splashscreen" plugin.google.maps 1.2.2 "phonegap-googlemaps-plugin" plugin.http.request 1.0.0 "phonegap-http-request"

wf9a5m75 commented 10 years ago

Thank you. I will check those plugins tonight.

starostin commented 10 years ago

Thank you very much)

wf9a5m75 commented 10 years ago

Oh, could you help me one more thing? Because of you are using Android 4.4.4, you can record the screen capture as video, and I haven't reproduced this issue yet. In order to confirm the issue, could you take a video then upload to the youtube?

starostin commented 10 years ago

I can try

wf9a5m75 commented 10 years ago

Thank you for your help.

I added some code to improve the webview performance generally. Try the plugin on the test branch.

$> cordova plugin add https://github.com/wf9a5m75/phonegap-googlemaps-plugin#test --variable ...
starostin commented 10 years ago

I have replaced GoogleMaps.java, but it is still slow(

wf9a5m75 commented 10 years ago

I see.

wf9a5m75 commented 10 years ago

How about comment out the below lines? https://github.com/wf9a5m75/phonegap-googlemaps-plugin/blob/master/www/googlemaps-cdv-plugin.js#L1969-L2003

starostin commented 10 years ago

I have already at home, so I will check it tomorrow. Thanks

wf9a5m75 commented 10 years ago

Ok. On Oct 20, 2014 12:04 PM, "starostin" notifications@github.com wrote:

I have already at home, so I will check it tomorrow. Thanks

— Reply to this email directly or view it on GitHub https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/261#issuecomment-59821939 .

starostin commented 10 years ago

No, it is still slow

starostin commented 10 years ago

Seems I have found the problem. There two lines with webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); if comment them, everything works ok)

wf9a5m75 commented 10 years ago

I added them today. On Oct 20, 2014 11:43 PM, "starostin" notifications@github.com wrote:

Seems I have found the problem. There two lines with webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); if comment them, everything works ok)

— Reply to this email directly or view it on GitHub https://github.com/wf9a5m75/phonegap-googlemaps-plugin/issues/261#issuecomment-59885768 .

starostin commented 10 years ago

But after commenting this lines screen with map blinks after first opening

starostin commented 10 years ago

they are on GoogleMaps.java line 175, and MyPluginLayout.java line 56

starostin commented 10 years ago

Is there any solutions to avoid blinks?)

michaeleparkour commented 10 years ago

Really can confirm that overriding to Software mode slows app. But if just comment these lines - map blinks on creating and even with wrong sizes, and refreshLayout() doesn't helps.

wf9a5m75 commented 10 years ago
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

The above line needs to place the map under the browser view. Because some Android webview does not change the opacity without this specify.

starostin commented 10 years ago

It is sad. But for me better blinks than slow app(

wf9a5m75 commented 10 years ago

Ok, how about the remove android:hardwareAccelerated="true" from the AndroidManifest.xml file?

starostin commented 10 years ago

I will try, but I thought without this my app become slower, or no?

wf9a5m75 commented 10 years ago

I don't know. I haven't reproduced the slower situation even if I use Nexus 7 2012 model with Android 4.4.4 (old one than yours).

starostin commented 10 years ago

It did not help( Thank you for attention)

wf9a5m75 commented 10 years ago

@starostin

Add android:largeHeap="true" attribute into <application> tag in the ApplicationManifest.xml file under the platforms/android/

The plugin can not add this attribute automatically, so please add by hand.

android:largeHeap="true" allows large heap memory allocation.

I don't know this helps to solve your case, but the issue #224, which is similar case with yours, is effected at least for me.

If this does not help, please share your project with me using github. I will investigate yours.

wf9a5m75 commented 10 years ago

@starostin Any update?

starostin commented 10 years ago

Sorry, was not at work. I set android:largeHeap="true", but it did not help. A cant share project, because it is not my project( I will create new one, and then give you an access

wf9a5m75 commented 10 years ago

@starostin Thank you, I'll be waiting.

wf9a5m75 commented 10 years ago

Since there is no new information, I close this issue at once. However you can still discuss for this. If you have a new information, please let me know through this thread.