Receiving location events

In plugin version 3.3.0 for iOS and 3.8.0 for Android we introduced support for receiving location events. Every time the plugin detects the location of the device, it calls a hook you can define. A use-case for this functionality is localizing content based on device location in a battery-efficient way.

The frequency of calls to this hook differs on multiple variables and may change between plugin version updates. For example, the plugin requests the location more frequently when the phone is connected to a charger or when the app is in the foreground.

Whenever the plugin detects a new location, it posts a notification you can subscribe to.

#import <PlotProjects/Plot.h>

[[NSNotificationCenter defaultCenter]
                       addObserver:self
                       selector:@selector(handleLocationUpdate:)
                       name:PlotLocationUpdateMessageName
                       object:nil];
-(void)handleLocationUpdate:(NSNotification*)notification {
    PlotLocationWithAccuracy* receivedLocation = notification.userInfo[PlotLocationKey];
    //store or do something with the location
}