Question

I was adding a adlink to my app and followed all the steps on RevMob's site, but i get the error "Cannot convert from void to RevMobLink". This is the code I'm using:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_original);
    setTitle("Original");


     RevMob revmob = RevMob.start(this, "536a384465333af826af24f2c");
        RevMobAdsListener listener = new RevMobAdsListener() {
            public void onRevMobAdReceived() { Log.i("[RevMob]", "onAdReceived"); }
            public void onRevMobAdNotReceived(String message) {} // you can create an workaround here
            public void onRevMobAdDisplayed() {}
            public void onRevMobAdDismiss() {}
            public void onRevMobAdClicked() {}
        };
        RevMobLink link = revmob.openAdLink(this, listener);
Was it helpful?

Solution

You have to start the session as it follows (http://sdk.revmobmobileadnetwork.com/android.html#session):

public class YourMainActivity extends Activity {
    private RevMob revmob;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Starting RevMob session
        revmob = RevMob.start(this); // RevMob App ID configured in the AndroidManifest.xml file
    }
}

In your manifest file, insert your app ID:

<application>
    <meta-data android:name="com.revmob.app.id" android:value="copy your RevMob App ID here"/>
</application>

And open the link ad unit using (http://sdk.revmobmobileadnetwork.com/android.html#link)

revmob.openAdLink(this, listener);

or pre-load it the way you did:

RevMobLink link = revmob.createAdLink(this, listener);

and open it after:

link.open();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top