1. Flutter – Monetize ...
  2. User Guide
  3. Commencer

Commencer

Prerequisites

  • Flutter 3.3.0 or higher
    • Android
      • Use Android Studio 3.2 or higher.
      • Make sure that your app’s build file uses the following values:
        • A minSdkVersion of 21 or higher.
        • A compileSdkVersion of 28 or higher.
    • iOS
      • Use XCode 15.2 or higher.
      • A minimumDeploymentTarget is 12 or higher.

App Configuration

1. Add “Refinery89 Monetize App“ dependency from Pub.dev.

dependencies:
  refinery89_monetize_app:
  • Install the package by running the following command

flutter packages get
  • Import “Refinery89 Monetize App“ into your Flutter app.

import 'package:refinery89_monetize_app/r89_sdk.dart';

2. Android Configuration.

2.1 Gradle Dependencies

In this project build.gradle:

allprojects {
  repositories {
    google()
    mavenCentral()
  }
}

2.2 Add Google ID Manifest.

Add this code to the manifest inside the <application> tag:

<meta-data
  android:name="com.google.android.gms.ads.APPLICATION_ID"
  android:value=<the-google-id>/>
  • Test: Use "ca-app-pub-3940256099942544~3347511713" for <the-google-id> this is from google official docs

  • Production: Use your own Google Id provided by us for <the-google-id>.
    If you have your own Google ID, follow these steps in the ‘Find the Google Mobile Ads Application IDs’ section.

A simplified example would look something like this:

<manifest>
  <application
  ...>
  <!-- The value is the test id from Google ad manager docs -->
  <meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value=<the-google-id>/>
    ...
    <activity
    ...>
    ...
    </activity>
  </application>
</manifest>
For countries that need CMP consent add @style/Theme.AppCompat.NoActionBar to the application’s theme tag in the manifest, otherwise SDK will crash on initialization.
<manifest>
  <application
  ...
  android:theme="@style/Theme.AppCompat.NoActionBar"
  ...>
  ...
  </application>
</manifest>

3. iOS Configuration.

According to Google Ads documentation update the Info.plist file to add the following two keys.

  1. A GADApplicationIdentifier key with a string value of your AdMob app ID found in the AdMob UI.

  2. A SKAdNetworkItems key with SKAdNetworkIdentifier values for Google (cstr6suwn9.skadnetwork) and select third-party buyers who have provided these values to Google.

The complete snippet.

4. Flutter Configuration.

The R89SDK uses the navigatorObservers to properly destroy ads when the screen closes and to track the route transitions to display interstitial ads if configured.

@override
Widget build(BuildContext context) {
  return MaterialApp(
    // ...
    navigatorObservers: [
      R89SDK.routeObserver,
    ],
    // ...
  );
}

4. Initialize “Refinery89 Monetize App“ SDK.

SDK supports two initialization types. Use JUST ONE of them.

Before opting for the initialization type, please consider reviewing the comparison page ou veuillez nous contacter.

Formats Available

 

Comment pouvons-nous aider ?