0

Android アプリに Smaato 動画広告を実装しようとしています。Smaato ページと Smaato サンプル アプリの指示に従いましたが、Smaato 動画広告を表示できません。動画広告をフルスクリーンで表示するコードは次のとおりです。

private static Video smaatoVideoAd; // A Smaato Video global variable

smaatoVideoAd = new Video(this.getApplicationContext());
smaatoVideoAd.getAdSettings().setPublisherId(0); //int of 0 is supposedly a test mode
//smaatoVideoAd.getAdSettings().setPublisherId(PublisherID);
smaatoVideoAd.getAdSettings().setAdspaceId(0);  //int of 0 is supposedly a test mode
//smaatoVideoAd.getAdSettings().setAdspaceId(VideoAd_ID);
smaatoVideoAd.setVastAdListener(this);
smaatoVideoAd.setAutoCloseDuration(5);
smaatoVideoAd.disableAutoClose(true);
smaatoVideoAd.setVideoSkipInterval(3);
} // End of onCreate

// Called when the video has been loaded.
@Override
public void onReadyToShow() {
    // Call this when you want to show the video ad.
    smaatoVideoAd.show();
}

@Override
    public void onWillShow() {
    // Called when the ad will show.
}

@Override
public void onWillOpenLandingPage() {
    // Called when the banner has been clicked.
}

@Override
public void onWillClose() {
    // Called when Interstitial ad will be closed.
}

@Override
public void onFailedToLoadAd() {
    // called when video failed to load.
}

build.gradle の Smaato ライブラリがセットアップされました。これは非常に簡単で短いものです。

 repositories {
 ...
     flatDir {
         dirs 'libs'
     }
 ...
 }

 dependencies {
 ...
     implementation name:'SOMAAndroid-9.1.3-release', ext:'aar'
 ...
 }

そして AndroidManifest.xml で:

 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
 <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

 <uses-feature android:name="android.hardware.location.gps" />
 <uses-feature android:name="android.hardware.location.network" />

 <meta-data android:name=”com.google.android.gms.version” android:value=”@integer/google_play_services_version”/>
 <activity android:name="com.smaato.soma.interstitial.InterstitialActivity" android:resizeableActivity="false" android:screenOrientation="landscape" />
 <activity android:name="com.smaato.soma.video.VASTAdActivity" android:resizeableActivity="false" android:screenOrientation="landscape" />
 <activity android:name="com.smaato.soma.ExpandedBannerActivity" android:resizeableActivity="false" android:screenOrientation="landscape" />

さらに、Smaato は次のように宣言しています

しかし、このコードを実行すると、Logcat に次のアラートが表示されます。

SOMA_VIDEO: ビデオは、表示する前にロードする必要があります

そのため、ビデオの追加がまったく読み込まれていません。ここで何が欠けていますか?手伝って頂けますか?ありがとう。

4

1 に答える 1