我在我的应用中添加了一个adlink,并按照RevMob网站上的所有步骤操作,但我收到错误“无法从void转换为RevMobLink”。这是我正在使用的代码:
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);
答案 0 :(得分:0)
您必须按照以下步骤开始会话(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
}
}
在您的清单文件中,插入您的应用ID:
<application>
<meta-data android:name="com.revmob.app.id" android:value="copy your RevMob App ID here"/>
</application>
使用(http://sdk.revmobmobileadnetwork.com/android.html#link)
打开链接广告单元revmob.openAdLink(this, listener);
或按照您的方式预加载:
RevMobLink link = revmob.createAdLink(this, listener);
并在以下后打开:
link.open();