1

I have problem on Revmob. I want to add revmob banner ads on my project but it doesn't show anything. Please help me to find-out my mistake.

My MainActivity.java

  package com.test.project;

import android.util.Log;
import rm.com.android.sdk.Rm;
import rm.com.android.sdk.RmListener;
import rm.com.android.sdk.ads.banner.RMBannerView;

public class MainActivity extends BaseActivity {

    String YOUR_REVMOB_APP_ID = "59d8ea0d23a7ae2ea50a0688";
    String YOUR_REVMOB_PLACEMENT_ID = "59d8ea0d23a7ae2ea50a0688";
    RMBannerView banner;

@Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.your_layout);

      Rm.init(this, YOUR_REVMOB_APP_ID);

/** Cache Banner **/
       Rm.cacheBanner(YOUR_REVMOB_PLACEMENT_ID, new RmListener.Cache() {

           @Override
           public void onRmAdReceived() {
               Log.i("RevMob","Banner Ready to be Displayed");
               //At this point, the banner is ready to be displayed.
               showBanner();
           }

           @Override
           public void onRmAdNotReceived(String message) {
               Log.i("RevMob","Banner Not Failed to Load");
           }
       });
   }

   public void showBanner() {

       if (Rm.isBannerLoaded(YOUR_REVMOB_PLACEMENT_ID)) {
           banner = Rm.getBanner(this, YOUR_REVMOB_PLACEMENT_ID, new RmListener.Get() {

               @Override
               public void onRmAdDisplayed() {
                   Log.i("RevMob","Banner Displayed");
               }

               @Override
               public void onRmAdFailed(String message) {
                   Log.i("RevMob","Banner Not Failed to Load");
               }

               @Override
               public void onRmAdDismissed() {
                   Log.i("RevMob","Banner Dismissed");
               }

               @Override
               public void onRmAdClicked() {
                   Log.i("RevMob","Banner Clicked");
               }
           });

           /** Show Banner **/
           ViewGroup view = (ViewGroup) findViewById(R.id.layout_banner);
           view.removeAllViews();
           view.addView(banner);
       }
   }
}

My activitymain.xml

<linearlayout android:id="@+id/layout_banner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_horizontal">
</linearlayout>

My AndroidManifest.xml

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.test.project">


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

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

    <application
        tools:replace="android:icon"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity
            android:name=".MainActivity"
            android:configChanges="keyboardHidden|orientation"
            android:label="@string/app_name"
            android:theme="@style/AppLTheme"
            android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

           <activity android:name="rm.com.android.sdk.RmInterstitial"
            android:configChanges="keyboardHidden|orientation|screenSize">
        </activity>

 </application>
</manifest>

My gradle

dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.2.0' testCompile 'junit:junit:4.12' compile files('libs/rm.jar') }

Help me to resolves this problem!

Zoe
  • 27,060
  • 21
  • 118
  • 148
Shubham
  • 25
  • 1
  • 1
  • 9
  • Android Studio is an IDE. (I get what you're trying to ask, but you still have to learn the difference). Using Android Studio isn't the same as showing ads in Android Studio. – Zoe Oct 10 '17 at 19:07
  • @Zoe Thanks for your feedback. Please help me to avoid this problem! – Shubham Oct 11 '17 at 04:25

0 Answers0