1. IOS – Monetize App ...
  2. User Manual
  3. Initialization Types
  4. Manual Initialization

Manual Initialization

How Does It Work?

We fetch all units configurations from our Database and you simply need to place the units using the IDs we provide to you with the RefineryAdFactory. Incorporate them into the desired views. The factory methods work as follows:

     
    class MainViewController: UiViewControlelr {
        // The SDK will place the advertisement inside this view.
        @IBOutlet var adContainer:UIView!
        …
        override func viewDidLoad() {
            super.viewDidLoad()
            let configurationID = ConfigBuilder.companion.BANNER_TEST_R89_CONFIG_ID
            RefineryAdFactory.shared.createBanner(configurationID: configurationID,
            wrapper: adContainer,
            lifecycleCallbacks: nil)
        }
        …
    }
    

Check Ad formats to see how to do it with each format.

What Is Needed?

  1. Get started by creating an account with us. Contact us to initiate the process and provide all the necessary information listed below.

  2. Add the wrapper/trigger (transitions ou button clicks) into your app.

  3. Add the Initialization code.

  4. Follow our ad format guides for their implementation.

    1. Get those wrappers or triggers from Activities or Fragments.

    2. Use RefineryAdFactory to display the ads.

  5. Your app is now prepared for monetization with us.

Information we require about your app

  • Which formats do you intend to utilize? If you’re unsure about the formats, please refer to their dedicated pages or reach out for assistance by contacting us.

  • Store Link (Google ou Apple one).

  • Domain of the app. E.g: www.refinery89.com

  • (Optional) Desired App Keywords.

Examples

At the end of the example, you can find a template for production here.


If you are in Debug mode, please add these lines before any of the examples. Marking the SDK as Debug will make the SDK use ConfigBuilder IDs and data.

     
    R89SDK.shared.setLogLevel(level: LogLevels.debug)
    R89SDK.shared.setDebug(getLocalFakeData: true,
    forceCMP: true,
    useProductionAuctionServer: false)
    

The example in the demo

O singleLine flag is set to false. Use the RefineryAdFactory to create and place the ADs in a UIView.

     
    R89SDK.shared.initialize(publisherId: “TestRefinery89ID”,
    appId: “TestConfigDemoApp”,
    singleLine: false,
    publisherInitializationEvents: nil)
    

Template

     
        R89SDK.shared.initialize(publisherId: <YOUR PUBLISHER ID>,
        appId: <YOUR APP ID>,
        singleLine: false,
        publisherInitializationEvents: nil)
    

Initialization

To initialize the SDK call R89SDK.shared.initialize method and pass the publisherId e appId.

     
        class MainViewController: UIViewController {
            override func viewDidLoad() {
                super.viewDidLoad()
                R89SDK.shared.initialize(publisherId: “TestRefinery89ID”,
                appId: “TestConfigDemoApp”,
                singleLine: false,
                publisherInitializationEvents: nil)
            }
        }
    

At this point, the advertisements can be displayed. To place a simple banner Ad follow the example below

     
        class MainViewController: UIViewController {

            @IBOutlet var adContainer:UIView! = nil
            
            override func viewDidLoad() {
                super.viewDidLoad()
                R89SDK.shared.initialize(publisherId: <YOUR PUBLISHER ID>,
                appId: <YOUR APP ID>,
                singleLine: false,
                publisherInitializationEvents: nil)
                
                RefineryAdFactory.shared.createBanner(configurationID: <R89-Banner-ID>, wrapper: adContainer, lifecycleCallbacks: nil)
            }
        }
    

The SDK will put the advertisement inside the provided adContainer.

Note that no need to await for SDK initialization, advertisements can be used right after calling the R89SDK.shared.initialize method.


Como podemos ajudar?