-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(myLocation): call MyLocationButton programmatically #136
Comments
Thanks for opening this issue. I am not aware of such a feature in either the iOS or the Android SDK. We will divert from the Of course this use case is special since in the Android or iOS SDK, it would typically not happen that you'd have an overlay HTMLElement in place. But still it would be possible in Android and iOS to remove the default myLocationButton and replace it with your own as well. And even then you would still need to do the custom logic you described above as well. What do you think? |
I quickly did some research and also did not find such a method natively. I found the implementation on stackoverflow, where for IOS and Android only a few lines of code are needed. In your documentation I have not yet found a method that allows retrieving the current location (correct me here if I'm wrong). For me as a enduser of this plugin, implementing this to the plugin brings of course a lot of comfort. Whats your opinion about that? |
Yeah that's the thing. Retrieving the location should be done by using the offical Capacitor geolocation plugin. It would not make sense to include such a method in this plugin. But since adding a feature like Maybe I could add this functionality on the JavaScript side only, and then make However, this would require the Capacitor team (or anyone for that matter) to first answer my open question here: ionic-team/capacitor#5429 |
@tafelnl doing this experiment, all method execution from the web is handle by Capacitor to the plugin using the Two-Way communication system of the browser (postMessage). There's not actual parsing, everything is converted to a Dictionary. (Reference). In this point you can parse and get the element, but there's no easy way to overwrite this method. Edit: This is from iOS perspective |
!! This feature request is related to the fork of @tafelnl !!
Is your feature request related to a problem? Please describe.
Currently it is possible to display the native myLocationButton in the map, which allows navigation to the current location.
At the moment, programmatic navigation is not possible, which excludes two important use-cases:
ion-fab-button
instead of MyLocationButton). This also allows the button to be placed anywhere (instead of just bottom right)A workaround would be the method
moveCamera()
by querying the current location beforehand.However, this loses the advantage of the event listener
didTapMyLocationButton()
.Describe the solution you'd like
Extend CapacitorGoogleMaps with the method
tapMyLocationButton()
, which triggers the click on myLocationButton.The text was updated successfully, but these errors were encountered: