次の方法で共有


Android SDK の初期化 v8.0

Android SDK v8.0 を使用するパブリッシャーは、広告要求を行う前に Xandr SDK を初期化する必要があります。 Xandr Mobile Ads SDK for Android SDK v8 を使用する場合は、他の init() SDK 操作の前にメソッドを呼び出す必要があります。 この初期化がないと、広告要求は送信されず、SDK は例外をスローします。

API 署名

/**
 * Initialize Xandr Ads SDK
 * @param memberId for initialising the XandrAd,
 * @param context for pre-caching the content.
 * @param preCacheContent enable / disable pre-caching of the content.provides flexibility to pre-cache content, such as fetch userAgent, fetch AAID and activate OMID. Pre-caching will make the future ad requests faster.
 * @param initListener for listening to the completion event.
 * */
public static void init(int memberId, Context context, boolean preCacheContent, final InitListener initListener)

注:

以下のメソッドは、v8.4 以降で使用できます。

/**
  * Initialize Xandr Ads SDK
  * @param memberId for initialising the XandrAd,
  * @param context for pre-caching the content.
  * @param preCacheContent enable / disable pre-caching of the content.provides flexibility to pre-cache content, such as fetch userAgent, fetch AAID and activate OMID. Pre-caching will make the future ad requests faster.
  * @param preCacheMraidSupports enable / disable pre-caching of the intent activities, false by default.
  * @param initListener for listening to the completion event.
  * */
 public static void init(int memberId, final Context context, boolean preCacheContent, boolean preCacheMraidSupports, final InitListener initListener)

XandrAd.init() は次のように使用できます。

XandrAd.init(1234, mContext, true, new InitListener() {
    @Override
    public void onInitFinished(boolean success) {
        Toast.makeText(getActivity(), "Init Finished with " + success, Toast.LENGTH_SHORT).show();
    }
});