TestsTested | ✓ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Ayaka Nonaka, Dasmer Singh, Mark Adams.
VENPromotionsManager enables easy definition, management and control of in-app location based promotions including the following:
You can install VENPromotionsManager in your project by using CocoaPods:
pod 'VENPromotionsManager', '~> 1.0.0'
First create one (or more) promotion(s). Promotions can be either region based (using beacons or geofencing) or location based which require periodic location lookups.
//Location Promotion
VPLLocationPromotion *locationPromotion = [[VPLLocationPromotion alloc] initWithCity:@"Cupertino"
state:@"CA"
country:@"United States"
uniqueIdentifier:userDefaultsKey action:^{
NSLog(@"Promotion Number %ld Fired",(long)(i+1));
}];
//Beacon based Region Promotion
NSUUID *estimoteUUID = [[NSUUID alloc] initWithUUIDString:@"B9407F30-F5F8-466E-AFF9-25556B57FE6D"];
CLBeaconRegion *doorRegion = [[CLBeaconRegion alloc] initWithProximityUUID:estimoteUUID
identifier:@"VenmoEntrancePromotion"];
VPLRegionPromotion *regionPromotion = [[VPLRegionPromotion alloc] initWithRegion:doorRegion
repeatInterval:2
enterAction:^{
//Implement code to launch promotion here
}];
Then init the promotions manager with an array of the created promotion(s)
self.promotionsManager = [[VPLPromotionsManager alloc] initWithPromotions:@[locationPromotion, regionPromotion]
shouldRequestGPSAccess:YES];
self.promotionsManager.refreshInterval = 60 * 60; //Lookup location every 60 minutes
[self.promotionsManager startMonitoringForPromotionLocations];
In this example, the VPLPromotionsManager instance will perform a location lookup and trigger any valid location promotion every 60 minutes and will trigger any valid region promotions whenever it enters the promotion's region. Region promotions support background notifications, while location promotions do not.
We'd love to see your ideas for improving VENPromotionsManager! The best way to contribute is by submitting a pull request. We'll do our best to respond to your patch as soon as possible. You can also submit a new Github issue if you find bugs or have questions.
Please make sure to follow our general coding style and add test coverage for new features!
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)