Hello. I have google analytics where an alert shows every time the user opens the app. I would like it to be where the user only sees this alert the first time they open it if they decide to opt in.
If they decide not to opt in, I would like the alert to show every 7 days and allow them to change this in the settings app if they decide to opt in.
If they decide not to opt in, I would like the alert to show every 7 days and allow them to change this in the settings app if they decide to opt in.
Code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Google Analytics" message:@"With your permission usage information will be collected to improve the application." delegate:self cancelButtonTitle:@"Opt Out" otherButtonTitles:@"Opt In", nil];
[av show];
return YES;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) {
case 0:
[[GAI sharedInstance] setOptOut:YES];
break;
case 1:
[[GAI sharedInstance] setOptOut:NO];
break;
default:
break;
}
}