Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected request for background location #173

Closed
Birowsky opened this issue Apr 1, 2017 · 5 comments
Closed

Unexpected request for background location #173

Birowsky opened this issue Apr 1, 2017 · 5 comments

Comments

@Birowsky
Copy link

Birowsky commented Apr 1, 2017

When certain conditions are met, the SDK requests background location, which opens permissions prompt:

screen shot 2017-03-31 at 15 05 27

To reproduce:

  1. User requires when-in-use location so the app prompts the user for permissions
  2. User provides permissions
  3. Restart the app

What i've noticed is that if the app doesn't have background location as a capability, this wouldn't happen.

screen shot 2017-04-01 at 13 41 09

Here's demo: https://youtu.be/qEUpoFQeELs

And then i noticed this issue, which points out that OneSignal SDK does do some unexpected stuff in the background.

Is there a way to disable all location stuff for OneSignal? At least as an intermediate solution for the time being?

@jkasten2
Copy link
Member

jkasten2 commented May 3, 2017

@Birowsky Do you have any other plugins in your app that could use the location permission? Please run cordova plugin list and attach the full list.

Your app would only request background location if NSLocationAlwaysUsageDescription was set in your Xcode .plist

@Birowsky
Copy link
Author

Birowsky commented May 3, 2017

Yes, cordova-background-geolocation.

That's the plugin that adds the background location capability.

But to test, I removed the plugin and added the capability by hand, with OneSignal being the only suspicious plugin installed. That's when I noticed the popup.

Since then, the project got restructured, and we moved to firebase for notifications. So I can assist you only by memory.

@iliraga
Copy link

iliraga commented Jan 3, 2018

Is there any update on this? We're facing the same issue. We are using cordova-background-geolocation in our project.
Somehow it leads to lot of issues when the onesignal cordova plugin requests the location before the cordova-background-geolocation plugin does. Is it possible to disable the location-relevat part of the onesignal plugin completly? We don't need location-aware push notifications in this case.

@Nightsd01
Copy link
Contributor

I have updated the SDK with a setLocationShared() function that will disable location sharing. You may want to call this function before you call endInit().

If anyone is still encountering this issue please feel free to reply (with a list of your plugins) and I'll be happy to investigate.

@canadaka
Copy link

canadaka commented Aug 8, 2018

We were trying to use Onesignal with our app, which also uses cordova-background-geolocation. The app has already been given iOS location access, but after I add the OneSignal plugin, it prompts the user again for location access. If i remove the OneSignal plugin, it doesn't.

I tried adding the setLocationShared(false) but it has no affect on the permission popup. Also when the device is registered and I look it up under Users in the OneSignal Dashboard, I can see my lat/lon so it's still fetching and getting my locaiton even though I set the above setting to false!

window.plugins.OneSignal
        .startInit(ONE_SIGNAL_APP_ID)
        .setLocationShared(false)
        .iOSSettings({kOSSettingsKeyAutoPrompt: false})
        .handleNotificationOpened(notificationOpenedCallback)
        .endInit();

This seems to only happen when i'm upgrading/overwriting the app with a Testflight version. If I install the app fresh from Testflight I only get a location permission dialog once, as it should be.

We wouldn't mind using the location feature, but having the app ask for permission again when users have already given it, is a non-starter for us. So unless there is a fix or solution, we can't use OneSignal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants