0

I am very new to nativescript-vue. I was testing my codes on stackblitz. I used webview to load html page. But html geolocation api is not working. What should I do? Thanks in advance.

My Code Is:

<template>
  <Page>
    <ActionBar>
      <Label text="Home" />
    </ActionBar>

    <GridLayout>
      <WebView src="https://azowad.pythonanywhere.com/" />
      
      <Label class="info" :text="message" @tap="logMessage" />
    </GridLayout>
  </Page>
</template>

<script lang="ts">
import Vue from 'nativescript-vue';

export default Vue.extend({
  computed: {
    message() {
      return 'Blank {N}-Vue app';
    },
  },

  methods: {
    logMessage() {
      console.log('You have tapped the message!');
    },
  },
});
</script>

<style scoped>
.info {
  font-size: 20;
  horizontal-align: center;
  vertical-align: center;
}
</style>

1 Answer 1

0

It seems that on iOS the WebView asks to access the location, while on Android not. Based on the answers to this question, I tried using a custom WebChromeClient which implements the onGeolocationPermissionsShowPrompt method, but it didn't work.

Do you explicitly have to use a WebView? As a workaround you could use the InAppBrowser plugin where Geolocation API works.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.