diff --git a/Classes/TiAdMobView.h b/Classes/TiAdMobView.h index e222073..acd016f 100644 --- a/Classes/TiAdMobView.h +++ b/Classes/TiAdMobView.h @@ -31,4 +31,8 @@ @property (nonatomic, retain) NSTimer *refreshTimer; @property (nonatomic, retain) AdMobView* admob; +@property (nonatomic, assign) double latitude; +@property (nonatomic, assign) double longitude; +@property (nonatomic, retain) NSDate* locationTime; + @end diff --git a/Classes/TiAdMobView.m b/Classes/TiAdMobView.m index 1433b77..1dd3fd7 100644 --- a/Classes/TiAdMobView.m +++ b/Classes/TiAdMobView.m @@ -15,7 +15,7 @@ @implementation TiAdMobView @synthesize publisher, test, refresh, adBackgroundColor, primaryTextColor, secondaryTextColor; -@synthesize refreshTimer, admob; +@synthesize refreshTimer, admob, latitude, longitude, locationTime; #pragma mark Cleanup @@ -28,6 +28,8 @@ -(void)dealloc [refreshTimer invalidate]; self.refreshTimer = nil; self.admob = nil; + self.locationTime = nil; + [super dealloc]; } @@ -45,6 +47,9 @@ -(void)initializeState self.test = NO; self.publisher = @""; self.refresh = AD_REFRESH_PERIOD; + self.latitude = 0; + self.longitude = 0; + self.locationTime = nil; } -(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds @@ -118,6 +123,17 @@ - (UIColor*)colorValue:(id)color_ return color; } +- (double)locationLatitude { + return self.latitude; +} +- (double)locationLongitude { + return self.longitude; +} +- (NSDate *)locationTimestamp { + return self.locationTime; +} + + #pragma Properties -(void)setHeight_:(id)height_ @@ -160,6 +176,21 @@ -(void)setSecondaryTextColor_:(id)color self.secondaryTextColor = [self colorValue:color]; } +-(void)setLatitude_:(id)latitude_ +{ + self.latitude = [TiUtils doubleValue:latitude_]; +} + +-(void)setLongitude_:(id)longitude_ +{ + self.longitude = [TiUtils doubleValue:longitude_]; +} + +-(void)setLocationTime_:(id)locationTime_ +{ + self.locationTime = [NSDate dateWithTimeIntervalSince1970:[TiUtils floatValue:locationTime_]/1000.0]; +} + #pragma Public APIs @end diff --git a/README.md b/README.md index f3878b0..14dc00f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,10 @@ HOW TO USE IT adBackgroundColor: "#ffffff", primaryTextColor: "#000000", secondaryTextColor: "#000000", - refresh: 30.0 + refresh: 30.0, + latitude: 51.0, + longitude: -0.180, + locationTime: new Date() }); admob.addEventListener('error', function(error) { alert(error.message); @@ -38,7 +41,7 @@ INSTALL TiAdMob4iPhone 1. Open `Terminal` 2. Run below command - `python build.py && unzip jp.masuidrive.ti.admob-0.1.zip -d /Library/Application\ Support/Titanium/` + `python build.py && unzip jp.masuidrive.ti.admob-iphone-0.1.zip -d /Library/Application\ Support/Titanium/` REGISTER TO YOUR PROJECT