bradmartin / nativescript-advanced-webview

NativeScript plugin for Chrome CustomTabs on Android and SafariViewController on iOS.
Other
60 stars 28 forks source link

Use location in webview #13

Closed vcooley closed 7 years ago

vcooley commented 7 years ago

Is it possible for to use geolocation in an advanced webview? If so could you direct me to a resource that shows how?

Thanks.

bradmartin commented 7 years ago

Not native geolocation. I don't think this plugin is a good fit for doing location based events. A better approach if you need webcontent and to hook into the webview browser events would be the core webview for Nativescript and communicate with it via the exposed events it provides. This plugin doesn't offer much extensibility because it's not meant to be expanded but more so a faster implementation of showing web content in a native app with chrome or safari and not stock webview on a device. Hope that helps some. The native controls here just don't expose much in terms on communicating with the web content.

On Mon, May 8, 2017, 11:48 AM Vince Cooley notifications@github.com wrote:

Is it possible for to use geolocation in an advanced webview? If so could you direct me to a resource that shows how?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bradmartin/nativescript-advanced-webview/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AFulhIFYKqOT2n52cK6MdLdahKTFk1Kdks5r30dHgaJpZM4NUNR3 .

vcooley commented 7 years ago

Great, thanks for the quick response. Since we have control of the web content we need to display, and we only need the location on load, I will probably go with a solution that involves sending the location in the URL.

CristianHCol commented 7 years ago

@vcooley Could you solve this problem?. I was trying something similar, i have a webpage and i try to access to the localization througth html5 geolocalization api (navigator.geolocalization). But never showed the prompt to permissions.

vcooley commented 7 years ago

@CristianHCol I ended up solving my problem by just sending the latitude and longitude in the query params. You'll have to request the location from the phone using the nativescript-geolocation plugin.