XChannel platform is Beacon vendor-agnostic and supports iOS and Android SDK. Our SDKs have been designed to be secure, reliable, and scalable. Want to give it a try?
Steps to integrate XChannel SDK into your app
Integrating our SDK into your app is fairly simple and straightforward.
- Contact us and obtain an app key and secret
- Download xChannel SDK package (Cocoapod for iOS and Gradle for Android)
- Include xChannel SDK package into your application build environment (Xcode or Android Studio)
- Integrate your application with our SDK
- Go to our application console and login using your credentials
- Setup your campaigns and activate them
- Finally, monitor your campaign performance in real-time from our Analytics page
iOS Sample Code
#import "XChannelSDK/XChannel.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[XChannel setAPIKey:XCHANNEL_API_KEY secret:@"YOUR_XCHANNEL_SECRET_KEY"];
[[LocationManager sharedInstance] startLocationQuery];
return YES;
}
//Delegate methods for CoreLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
...
[XChannel getBeaconsForLongitude:location.coordinate.longitude latitude:location.coordinate.latitude completion:^(NSArray* beacons, NSError *error) {
if (error == nil) {
for (XCBeacon *beacon in beacons) {
XCBeaconRegion *region = [[XCBeaconRegion alloc] initWithUUID:beacon.uuid];
//region may be nil if o.uuid is invalid
if (region) {
[locationManager startMonitoringForRegion:region];
}
}
}
}];
...
}
- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
if ([beacons count] > 0) {
//Beacon array is ordered by closest to farthest
CLBeacon *closestBeacon = beacons[0];
[XChannel getDealsForBeacon:closestBeacon region:region completion: ^(NSArray *beaconDeals, NSError *error) {
//Handle the deals returned
}];
}
}
#import "XChannelSDK/XChannel.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[XChannel setAPIKey:XCHANNEL_API_KEY secret:@"YOUR_XCHANNEL_SECRET_KEY"];
[[LocationManager sharedInstance] startLocationQuery];
return YES;
}
//Delegate methods for CoreLocation
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
...
[XChannel getBeaconsForLongitude:location.coordinate.longitude latitude:location.coordinate.latitude completion:^(NSArray* beacons, NSError *error) {
if (error == nil) {
for (XCBeacon *beacon in beacons) {
XCBeaconRegion *region = [[XCBeaconRegion alloc] initWithUUID:beacon.uuid];
//region may be nil if o.uuid is invalid
if (region) {
[locationManager startMonitoringForRegion:region];
}
}
}
}];
...
}
- (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region {
if ([beacons count] > 0) {
//Beacon array is ordered by closest to farthest
CLBeacon *closestBeacon = beacons[0];
[XChannel getDealsForBeacon:closestBeacon region:region completion: ^(NSArray *beaconDeals, NSError *error) {
//Handle the deals returned
}];
}
}
Android Sample Code (uses AltBeacon SDK)
import com.xemobi.xchannel.XChannel;
public class MainActivity extends AppCompatActivity implements XCBeaconDealNotifier {
....
XChannel.getInstance(getApplicationContext()).setApiKey(XCHANNEL_API_KEY, XCHANNEL_SECRET_KEY);
....
//Implement XCBeaconDealNotifier methods
@Override
public void didReceiveBeaconDeals(XCBeacon beacon, XCBeaconDeal xcBeaconDeal) {
if (xcBeaconDeal != null) {
...
}
}
@Override
public void didFailToReceiveBeaonDeals(XCBeaconDealNotifierException e) {...}
....
}
import com.xemobi.xchannel.XChannel;
public class MainActivity extends AppCompatActivity implements XCBeaconDealNotifier {
....
XChannel.getInstance(getApplicationContext()).setApiKey(XCHANNEL_API_KEY, XCHANNEL_SECRET_KEY);
....
//Implement XCBeaconDealNotifier methods
@Override
public void didReceiveBeaconDeals(XCBeacon beacon, XCBeaconDeal xcBeaconDeal) {
if (xcBeaconDeal != null) {
...
}
}
@Override
public void didFailToReceiveBeaonDeals(XCBeaconDealNotifierException e) {...}
....
}