It is a verry important topic About Admob

Get help using Construct 2

Post » Sun Sep 06, 2015 8:26 pm

I have recive a mail from admob (google) new cookie law for EU! :(

But how to add this code in our games?

Where to paste and how we dont have a "MainActivity" whern we expoet to intel sdk.


The code is for android:
Code: Select all
// This code works on Android API level 1 (Android 1.0) and up.
// Tested on the latest (at the moment) API level 19 (Android 4.4 KitKat).
// In the main activity of your app:

public class MainActivity extends Activity

  (...)

  @Override
  public void onStart() {
    super.onStart();
    final SharedPreferences settings =
        getSharedPreferences("localPreferences", MODE_PRIVATE);
    if (settings.getBoolean("isFirstRun", true)) {
      new AlertDialog.Builder(this)
        .setTitle("Cookies")
        .setMessage("Your message for visitors here")
        .setNeutralButton("Close message", new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which)
            settings.edit().putBoolean("isFirstRun", false).commit();
          }
        }).show();
    }
  }
}


And for Ios

Code: Select all
// This code will work in iOS 2 and up
// (spoiler: you're not going to need anything below iOS 6).
// Tested in iOS 7
// In your app's UIApplicationDelegate:

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  (...)
  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
  if (![defaults boolForKey:@"termsAccepted"])
    NSString *message =
      @"Your message for visitors here";
    UIAlertView *alert =
      [[UIAlertView alloc] initWithTitle:@"Cookies"
                                 message:message
                                delegate:self
                       cancelButtonTitle:nil
                       otherButtonTitles:@"Close message", nil];
    [alert show];
  }
}


I think it is a lot of people having trouble with this.
And yes me too :).
Thank's
B
4
Posts: 5
Reputation: 216

Return to How do I....?

Who is online

Users browsing this forum: 25games, Artcadev, grodrigues and 23 guests