Page 1 of 2

Cordova Geolocation Plugin running in background. How to disable?

Posted: Thu May 05, 2016 4:34 am
by Randy7611273

My app was just rejected by Apple for using background location services. When the app first launches, an alert appears saying "Allow to access your location even when you are not using the app?" I am using Geolocation 1.0.1 (Cordova Geolocation Plugin). I have not customized Geolocation. How can I make Apple happy, and only use Geolocation when the app is in the foreground, as intended?


Cordova Geolocation Plugin running in background. How to disable?

Posted: Fri May 06, 2016 7:16 pm
by Randy7611273

No UIBackgroundModes are being selected:

Image

I have made no modifications to the Geolocation services.
Image

I am simply invoking the Geolocation service when a certain page loads to determine the location of the client relative to an event list.


Cordova Geolocation Plugin running in background. How to disable?

Posted: Fri May 06, 2016 7:28 pm
by Randy7611273

The problem appears to be with the Geolocation service. I deleted and re-entered the service itself, and yet the problem remains. However, when I disable the service under App Settings Cordova plugins Geolocation, and still invoke the Geolocation service call, I get the following:

Image
Image


Cordova Geolocation Plugin running in background. How to disable?

Posted: Sat May 07, 2016 4:42 am
by Illya Stepanov

Hi Randy -

Could you explain in more detail how exactly you're invoking Geolocation service in your app and what event you're using?


Cordova Geolocation Plugin running in background. How to disable?

Posted: Sat May 07, 2016 8:15 pm
by Randy7611273

Event: Page Show
Invoke Service: Datasource: geolocation

Before send: No mapping
Success: Service response: latitude and longitude to Storage, lat and long respectively


Cordova Geolocation Plugin running in background. How to disable?

Posted: Mon May 09, 2016 3:01 pm
by Randy7611273

I could be mistaken, but this seems to be a known issue:

https://getsatisfaction.com/apperyio/...

Is it possibly related to the (old?) version of Cordova Geolocation Plugin 1.0.1?


Cordova Geolocation Plugin running in background. How to disable?

Posted: Mon May 09, 2016 5:34 pm
by Illya Stepanov

Hi Randy -

Run your Geolocation service initialization on the Device Ready event, not on the Page show event.


Cordova Geolocation Plugin running in background. How to disable?

Posted: Sun Sep 18, 2016 5:24 am
by Misfer

Hi,

I have the same exact problem when testing my app.

I changed the Geolocation service initialization to on the Device Ready event, instead of on the Page show event but still problem not fixed!!

I'm still getting an alert when the app first launches saying "Allow to access your location even when you are not using the app" which could cause Apple to reject my app

Any firm solution for this ???


Cordova Geolocation Plugin running in background. How to disable?

Posted: Sun Sep 18, 2016 9:55 am
by Illya Stepanov

This a standard behavior for current Cordova plugins running on the latest iOS versions. If you want to change the alert message that you are getting initially, you can use our solution here: https://docs.appery.io/docs/known-iss...


Cordova Geolocation Plugin running in background. How to disable?

Posted: Sun Sep 18, 2016 12:19 pm
by Misfer

Hi IIIya,

Thanks for the quick reply

As per Appery workaround solution I should delete the below line from the app.Info.plist under the Source tab in the builder .Please confirm ..

-------------

NSLocationAlwaysUsageDescription
Your location information will be used by this app. Choose "Allow" so the app can provide location services.

-----------------

One more thing ,do you recommend to delete it in Appery builder or shall I delete it within the Xcode after exporting as I will be able to do that as well