How to request "always" permission with Geolocation?

I am using the following two plugins
cordova-plugin-background-geolocation
corodva-plugin-geolocation

When I first attempt to get geolocation of the user, the user gets prompted to give permission to my app. However, the permission recorded is always “only when using the app”. I want the “always” permission because the background geolocation will need it. Any ideas what to do about this?

1 Like

Replying to my own question. Found the answer here --> https://ionicframework.com/docs/v2/native/backgroundgeolocation/

You have to call BackgroundGeolocation (even if it is a fake call before you call the regular geolocation, otherwise user will only be prompted for permissions when using the app!

import { BackgroundGeolocation } from 'ionic-native';


// When device is ready :
platform.ready().then(() => {
**// IMPORTANT: BackgroundGeolocation must be called within app.ts and or before Geolocation. Otherwise the platform will not ask you for background tracking permission.**