ioscllocationmanagercllocationinmobi

Determining the Location Accuracy for InMobi iOS Ads


I am using the InMobi SDK to provide some native ads for iOS. Within their documentation they have the following, for setting the location of the ad to provide more relevant data.

It should contain the latitude, longitude, and accuracy, separated by commas. This parameter is required if the request is needed to be considered for geo-targeting. The accuracy value should be "0" if the correct accuracy value is unavailable. Here, the accuracy is the radial accuracy of the lat-long data provided. More information on how to determine accuracy value is listed here.

http://en.wikipedia.org/wiki/Decimal_degrees

To gain the user location I use Core Location and the kCLLocationAccuracyBest param. How do I work out/know what to send as the location accuracy for InMobi based on this parameter?

InMobi Doc Ref - https://www.inmobi.com/support/monetization/?page_id=12&id=29129146&parentid=22884296


Solution

  • https://www.inmobi.com/support/art/26555436/22465648/api-2-0-integration-guidelines/#geo

    accu (integer) is the parameter, which comes from the parent object (JSON) geo

    ie:

    //when using CoreLocation to fetch the coordinate
    CLLocationManager *mgr = [[CLLocationManager alloc] init];
    CLLocation *loc = mgr.location;
    [InMobi setLocationWithLatitude:loc.coordinate.latitude longitude:loc.coordinate.longitude accuracy:loc.horizontalAccuracy];
    [locationMgr startUpdatingLocation];
    

    or

    InMobi setLocationWithLatitude:self.delegate.location.coordinate.latitude
    longitude:self.delegate.location.coordinate.longitude
    accuracy:self.delegate.location.horizontalAccuracy