How to get geolocation with Cordova Geolocation plugin from Android phone?

I am building an Android App with the Ionic Framework and I want to get the geolocation from my phone with Cordova Geolocation (https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/).

While testing the implementation in the browser (ionic serve), everything seems to work fine. But when I try to test it on the phone (Samsung Galaxy S6) the location will not be shown.

Unfortunately I can not see any errors for debugging with ionic cordova run android.

Does anyone has an idea how to fix this?

tracking.page.ts

import { Component, OnInit } from '@angular/core';
import { Geolocation } from '@ionic-native/geolocation/ngx';
import * as moment from 'moment';
import { NativeGeocoder, NativeGeocoderOptions, NativeGeocoderResult } from '@ionic-native/native-geocoder/ngx';

@Component({
  selector: 'app-tracking',
  templateUrl: './tracking.page.html',
  styleUrls: ['./tracking.page.scss'],
})
export class TrackingPage implements OnInit {
  geoLatitude: number;
  geoLongitude: number;
  geoAccuracy: number;

  watchLocationUpdates: any;
  loading: any;
  isWatching: boolean;

  // Geocoder configuration
  geoencoderOptions: NativeGeocoderOptions = {
    useLocale: true,
    maxResults: 5
  };

  constructor(
    private geolocation: Geolocation,
    private nativeGeocoder: NativeGeocoder
  ) { }

  getMoment() {
    return moment().milliseconds(0);
  }

  ngOnInit() {
    document.addEventListener('deviceready', onDeviceReady, false);
    function onDeviceReady() {
        console.log('navigator.geolocation works well');
    }
  }

      // Start location update watch
      watchLocation() {
        let options = {
          maximumAge: 3600000,
          timeout: 3000,
          enableHighAccuracy: true,
       }
        this.isWatching = true;
        this.watchLocationUpdates = this.geolocation.watchPosition();
        this.watchLocationUpdates.subscribe((resp) => {
          this.geoLatitude = resp.coords.latitude;
          this.geoLongitude = resp.coords.longitude;
          this.geoAccuracy = resp.coords.accuracy;
          timestamp: this.getMoment().format('x');
          // this.getGeoencoder(this.geoLatitude, this.geoLongitude);
        });
      }

      // Stop location update watch
      stopLocationWatch() {
        this.isWatching = false;
        console.log('this.isWatching = ', this.isWatching);
        this.watchLocationUpdates.unsubscribe();
      }
}

tracking.page.html

<ion-header>
  <ion-toolbar color="primary">
    <ion-title>
      <div class="titleicon">
        <div class="logo-img"><img src="../assets/logo.png" width="120px" /></div>
      </div>
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content class="ion-padding" style="text-align: center;">
  <!-- *ngIf="geoLatitude" -->
  <div> 
      Address: {{ geoAddress }}
    </h1> -->
    <h4>Latitude: {{geoLatitude}}</h4>
    <h4>Longitude: {{geoLongitude}}</h4>
    <p>Genauigkeit: {{geoAccuracy}} m</p>


  </div>´
  <ion-button (click)="watchLocation()">
    Route starten
  </ion-button>
  <br>
  <ion-button (click)="stopLocationWatch()" color="danger">
    Route beenden
  </ion-button>

</ion-content>

Source: New feed
Source Url How to get geolocation with Cordova Geolocation plugin from Android phone?