質問

I have an app that monitors location changes via the significant change notification feature of CoreLocation, this works fine as I only need to know about location changes when they change a lot like entering a different county or similar event.

My issue is that I need to know if a user stays in a location for a long period of time, so if the user stays in one place for a day or a week I would need a notification on each day.

Does CoreLocation provide that information? If not, does anyone have a suggestion on how this might be achieved?

役に立ちましたか?

解決

No, Core Location does not offer a feature like that.

IIRC, you can't do it, because you can't start the location service with the app in the background (for example, if you sent a silent push notification you couldn't quietly get the location). You can test this potential yourself though (I can't find it documented just now). You would need to stop and restart the location service, it would need to update you 'immediately' and continue to update on significant changes.

An alternate would be to request the user to open the app by using a local notification. Obviously you can't rely on the user actually doing that though...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top