Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Forked from anonymous/Phonegap - Flurry API
Created April 28, 2010 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianleroux/382455 to your computer and use it in GitHub Desktop.
Save brianleroux/382455 to your computer and use it in GitHub Desktop.
// In the .h file …..
#import
#import “PhoneGapCommand.h”
@interface FlurryAPI : PhoneGapCommand {
}
- (void)doit:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
@end
// in the .m file
#import “FlurryAPI.h”
@implementation FlurryAPI
- (void)logEvent:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
{
NSUInteger argc = [arguments count];
int total = 0;
for(int n = 0; n < argc; n++)
{
total += [[ arguments objectAtIndex:n] intValue];
}
NSString* retStr = [ NSString stringWithFormat:@"alert(\"%d\");",total];
[ webView stringByEvaluatingJavaScriptFromString:retStr ];
}
@end
// JS
PhoneGap.exec("FlurryAPI.logEvent","App_Load");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment