mapsplugin / cordova-plugin-googlemaps

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

Orientation Change issue on Android 5 #447

Closed roberthovhannisyan closed 9 years ago

roberthovhannisyan commented 9 years ago

Hi,

The plugin is great, thanks! Howerver we have issue when changing phone orientation and it seems like the problem occurs only on Android 5. When changing orientation from e.g. portrait to landscape, the rightmost area becomes non-touchable. It seems like the problem is with areas falling outside the size of previous orientation.

When we remove maps plugin everything works ok

wf9a5m75 commented 9 years ago

Call map.refreshLayout() after the orientation change.

roberthovhannisyan commented 9 years ago

Hi again, it didn't helped. As I understand map.refreshLayout() internally calls onMapResize (although passes strange data), which is automatically called on orientation change.

Were you able to reproduce the issue ?

wf9a5m75 commented 9 years ago

What version do you use? I merged the latest code into the master branch. Try to install the plugin from master branch.

wf9a5m75 commented 9 years ago

I develop on Nexus 5 always, and I don't face this issue. If the error occurs this issue with the master branch, there might be the error in your HTML or CSS.

roberthovhannisyan commented 9 years ago

I am using it through plugins.cordova.io, so I suppose it uses master branch. Further, I am using Phonegap Build v3.7.0. Will try to look more on html, although when I remove plugin row from config.xml orientation change works as expected.

wf9a5m75 commented 9 years ago

I haven't uploaded the latest code to plugins.cordova.io yet.

roberthovhannisyan commented 9 years ago

I am looking forward to testing it. Thanks again

hirbod commented 9 years ago

Try with

cordova plugin add https://github.com/wf9a5m75/phonegap-googlemaps-plugin#master --variable API_KEY_FOR_ANDROID.....

faced some issues today.. as I also forgot to download the lastest version

roberthovhannisyan commented 9 years ago

Hi again,

I've built my app with new version 1.2.5 from plugins.cordova.io. But the problem is still there. It seems like there is invisible layer in front of all views, which does not resized when orientation is changed and prevents taps outside of area of initial orientation. By the way I'm using Sencha Touch.

Do you have any ideas or suggestions on what to check ?

wf9a5m75 commented 9 years ago

Have you turned on the map.setDebuggable(true)?

On Fri, Mar 27, 2015, 3:35 AM roberthovhannisyan notifications@github.com wrote:

Hi again,

I've built my app with new version 1.2.5 from plugins.cordova.io. But the problem is still there. It seems like there is invisible layer in front of all views, which does not resized when orientation is changed and prevents taps outside of area of initial orientation. By the way I'm using Sencha Touch.

Do you have any ideas or suggestions on what to check ?

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

wf9a5m75 commented 9 years ago

I think there is some HTML elements on the map div. Check it with Google Chrome inspector(for Android) or Safari (for iOS)

roberthovhannisyan commented 9 years ago

Hi again, The problem I describe occurs not only when th view with the map is displayed. When I open app it is ok, when I rotate it there is non tappable area at the right side. I thin there some problem in plugin initialization, because when I remove plugin lines from config.xml everything works as expected.

I have turned on setDebuggable and the screenshot is attached. But I want to make sure again that the problem occurs before this view is even displayed, just after opening app. screenshot_2015-03-28-02-26-01 Another point worth mentioning is that I have checked for invisible divs with phonegap build weinre inspector tool, and did not find any invisible div at that area.

wf9a5m75 commented 9 years ago

Could you send me your apk to wf9a5m75@gmail.com?

roberthovhannisyan commented 9 years ago

I have sent it

wf9a5m75 commented 9 years ago

Um, at least, the plugin should draw the above region of the map as green.

wf9a5m75 commented 9 years ago

It seems you use old version. Try to use veraion 1.2.5

roberthovhannisyan commented 9 years ago

I am using phonegap build, and did not mention any specific version in config.xml. according to pgb documentation it should use the latest version. How can I ensure I am using the latest one?

roberthovhannisyan commented 9 years ago

Hi Masashi,

Did you received the phonegap project with sample app and were you able to reproduce the issue? Do you have any ideas on causes of the issue?

Thanks in advance

hirbod commented 9 years ago

Please remove the plugin and try to install from testbranch

Try with

cordova plugin add https://github.com/wf9a5m75/phonegap-googlemaps-plugin#test --variable API_KEY_FOR_ANDROID.....
roberthovhannisyan commented 9 years ago

https://github.com/wf9a5m75/phonegap-googlemaps-plugin#master

Will this install plugin from test branch ?

hirbod commented 9 years ago

sorry, I've updated my post. It's #test

Cause it has some improvements and considered stable.

roberthovhannisyan commented 9 years ago

Thanks @Hirbod,

However, now I've got build error

[javac] c:\SenchaTestPhonegap\platforms\android\src\plugin\google\maps\PluginMap.java:231: error: cannot find symbol

[javac]         webView.setZOrderOnTop(true);
[javac]                ^
[javac]   symbol:   method setZOrderOnTop(boolean)
[javac]   location: variable webView of type CordovaWebView
hirbod commented 9 years ago

Seems like I've missed something here. Actually setZOrderOnTop should only be called when building on crosswalk. @wf9a5m75 need to fix this. Sorry, as of two days ago, #test was totally stable.

roberthovhannisyan commented 9 years ago

Anyways, I've commented the specified line and it has successfully built. But still the main problem (orientation change issue) persist

roberthovhannisyan commented 9 years ago

Hi @Hirbod, @wf9a5m75 I was able to workaround the issue by setting android:hardwareAccelerated="false" on application in android manifest file.

This could be helpful for others using sencha touch

ra-krishna commented 9 years ago

hardware accelaration would be required for performance reasons, any other possible solution?

ghost commented 9 years ago

https://github.com/wf9a5m75/phonegap-googlemaps-plugin/wiki/Tutorial-for-CrossWalk-(Android)