IOS Track User Location Map kit - objective-c

How i can track user location using CoreLocation and MapKit? I place a point on the map. When the application is minimized to check whether the user has not reached the destination. If you reached to withdraw the notification.

Allow your application to run in background
In background, start your get geolocation thread active to get current location (on timely basis, after each 10 secs)
If the results gets approx. equal value (for ex.: 2 km. radius) to your location, then throw a local notification from that app.
To do all this, you will surely find documentation over web, topics are:
Allow your app to run in background
Fetch user's current location (Start this thread in background delegate method)
Match location
Fire local notification
These are the base flow points, hope this will help you for initial start up.

Related

react native background geolocation

I have a requirement to save user's geolocation when react-native app is running in background. I know react-native-background-geolocation is available for this but I don't want to use any third party tool for this. Is there a way I can fetch users current location even if the app is running in the background?
With the last Expo SDK 32 you should be able to to it.
We’re excited to announce that this release includes initial support for background location, a highly requested feature from many Expo users. You can now define simple JavaScript tasks in your app and register them to receive location updates in the background. Additionally, you can set up geofencing tasks that are triggered when the device enters or leaves specific geographic regions

Onesignal making user appear 'active' every hour

I am currently segmenting users by a location filter. However the location is only updated if the mobile app is in foreground. Is there a way to mimic the user's last activity / currently location every hour even if the app is in the background? I am currently using React Native.
You can update the player / user record with the last location through the REST API by sending lat and long.
https://documentation.onesignal.com/reference#edit-device
You will need to use a plugin or your own native code to get the location of the device in the background.

Dimiss location service alert using code

I am using Core Location API for one my Cocoa application. With every application launch, it throws an alert asking for user permission for location services. I want to use the location services but with each application launch I do not want user to give permissions. Is there any way to dismiss this alert from code and still have the lat/long co-ordinates returned.
I did a bit of research on devforums for you and if you run your app outside of Xcode, it shouldn't ask you for authorization each and every time.

NSURLConnection when app is in background

I'd like to know if is possible to send asynchronous connections when an app is in background. The reason for this is because I need to send the user's location (get from Core Location) to update a database in a remote server everytime the location changes, even if the app is not in foreground.
Do I have to set any permission for this? Does Apple rejects apps processing connections when app is in background?
Thanks in advance!!
iOS provides multitasking API's i.e. even if your app is in background, some of its API's can be accessed. These services are -
Local Notifications
Background Audio
Background Tasks
Background Location
So you can definitely send location updates using CoreLocation when the app is not in foreground.
This link - iOS multitasking has code to start your service when app in background. Step by step instructions
Specify location background mode
Use an NSTimer in the background by using UIApplication:beginBackgroundTaskWithExpirationHandler:
In case x time is smaller than UIApplication:backgroundTimeRemaining it does works just fine, in case x is larger, the location manager should be enabled (and disabled) again before there is no time remaining to avoid the background task being killed. This does work since location is one of the three allowed types of background execution.
SOURCE - How do I get a background location update every n minutes in my iOS application?
Here, from the apple documentation (http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW47)
There are several ways to track the user’s location in the background, most of which do not actually require your app to run continuously in the background:
-The significant-change location service (Recommended)
-Foreground-only location services
-Background location services
But you cannot send request, as the only possible things to do are :
-audio
-location
-voip
-newsstand
-Accessories & blutooth connection
So I guess you could store all your location, and send it with NSURLConnection once the app goes to foreground again

Creating a Metro app which updates itself Periodically and not placed in lock screen

As mentioned here:
It seems that a background task will only run using a TimeTrigger if the user has placed your app on the lock screen.
So, how can I create a Calendar like app without background task? I mean an app which:
updates its tile Periodically (e.g. once a day)?
updates its tile even when it's not running?
You should create a maintenance trigger. These triggers will only fire once every two hours and will only fire if the machine is on AC power. When your trigger runs, you could look for upcoming appointments and create scheduled toast notifications.
var scheduledToast = new Windows.UI.Notifications.ScheduledToastNotification(toastXml, startTime);
You could update the tile as well with a ScheduledTileNotifcation() call. Unfortunately, I don't think there is a way to remove a notification so if the user deletes an appointment prior to the scheduled notification, I don't think you can remove it. I'm looking deeper into that and will comment here if I find an answer.
However, I would think for a calendar app you would want it to use a TimeTrigger and be placed on the lock screen since I would want to receive appointment reminders at any time and regardless of being plugged in or not.
Is there a reason you do not want to use the TimeTrigger?
You can schedule periodic updates of an application's tile without being on the start screen. See this article for Notification Delivery methods. Then, once the app is launched, you could update the calendar in general.