Instantly share code, notes, and snippets.

Embed
What would you like to do?
RevMob Android SDK
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application>
<activity
android:name="com.revmob.ads.fullscreen.FullscreenActivity"
android:configChanges="keyboardHidden|orientation" >
</activity>
...
</application>
package com.revmob.sample.developer;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import com.revmob.RevMob;
import com.revmob.ads.banner.RevMobBanner;
import com.revmob.RevMobAdsListener;
public class MainActivity extends Activity {
// Just replace the ID below with your appID.
private static String APPLICATION_ID = "4f56aa6e3dc441000e005a20";
private RevMob revmob;
private RevMobAdsListener revmobListener;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Starting RevMob session
revmob = RevMob.start(this, APPLICATION_ID);
}
public void onStart() {
super.onStart();
revmobListener = new RevMobAdsListener() {
@Override
public void onRevMobAdDisplayed() {
Log.i("[RevMob]", "onAdDisplayed");
}
@Override
public void onRevMobAdReceived() {
Log.i("[RevMob]", "onAdReceived");
}
@Override
public void onRevMobAdNotReceived(String message) {
Log.i("[RevMob]", "onAdNotReceived");
}
@Override
public void onRevMobAdDismiss() {
//Not implemented.
}
@Override
public void onRevMobAdClicked() {
Log.i("[RevMob]", "onAdClicked");
}
};
}
public void showBanner(View view) {
RevMobBanner banner = revmob.createBanner(this, revmobListener);
// Lookup your LinearLayout (We are assuming it’s been given
// the attribute android:id="@+id/banner")
LinearLayout layout = (LinearLayout)findViewById(R.id.banner);
// Add the banner to it
layout.removeAllViews();
layout.addView(banner);
}
public void hideBanner(View view) {
// Lookup your LinearLayout (We are assuming it’s been given
// the attribute android:id="@+id/banner")
LinearLayout layout = (LinearLayout)findViewById(R.id.banner);
// Remove the banner
layout.removeAllViews();
}
}
<LinearLayout
android:id="@+id/banner"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:visibility="gone">
</LinearLayout>
<LinearLayout
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
package com.revmob.sample.developer;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import com.revmob.RevMob;
import com.revmob.ads.fullscreen.RevMobFullscreen;
import com.revmob.RevMobAdsListener;
public class MainActivity extends Activity {
// Just replace the ID below with your appID.
private static String APPLICATION_ID = "4f56aa6e3dc441000e005a20";
private RevMob revmob;
private RevMobAdsListener revmobListener;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Starting RevMob session
revmob = RevMob.start(this, APPLICATION_ID);
}
public void onStart() {
super.onStart();
revmobListener = new RevMobAdsListener() {
@Override
public void onRevMobAdDisplayed() {
Log.i("[RevMob]", "onAdDisplayed");
}
@Override
public void onRevMobAdReceived() {
Log.i("[RevMob]", "onAdReceived");
}
@Override
public void onRevMobAdNotReceived(String message) {
Log.i("[RevMob]", "onAdNotReceived");
}
@Override
public void onRevMobAdDismiss() {
Log.i("[RevMob]", "onAdDismiss");
}
@Override
public void onRevMobAdClicked() {
Log.i("[RevMob]", "onAdClicked");
}
};
}
public void showFullscreen(View view) {
RevMobFullscreen fs = revmob.createFullscreen(this, revmobListener);
fs.show();
}
}
package com.revmob.sample.developer;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import com.revmob.RevMob;
public class MainActivity extends Activity {
// Just replace the ID below with your appID.
private static String APPLICATION_ID = "4f56aa6e3dc441000e005a20";
private RevMob revmob;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Starting RevMob session
revmob = RevMob.start(this, APPLICATION_ID);
}
public void onStart() {
super.onStart();
}
public void showFullscreen(View view) {
revmob.showFullscreen(this);
}
}
package com.revmob.sample.developer;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import com.revmob.RevMob;
import com.revmob.ads.popup.RevMobPopup;
import com.revmob.RevMobAdsListener;
public class MainActivity extends Activity {
// Just replace the ID below with your appID.
private static String APPLICATION_ID = "4f56aa6e3dc441000e005a20";
private RevMob revmob;
private RevMobAdsListener revmobListener;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Starting RevMob session
revmob = RevMob.start(this, APPLICATION_ID);
}
public void onStart() {
super.onStart();
revmobListener = new RevMobAdsListener() {
@Override
public void onRevMobAdDisplayed() {
Log.i("[RevMob]", "onAdDisplayed");
}
@Override
public void onRevMobAdReceived() {
Log.i("[RevMob]", "onAdReceived");
}
@Override
public void onRevMobAdNotReceived(String message) {
Log.i("[RevMob]", "onAdNotReceived");
}
@Override
public void onRevMobAdDismiss() {
//Not implemented.
}
@Override
public void onRevMobAdClicked() {
Log.i("[RevMob]", "onAdClicked");
}
};
}
public void revMobOpenPopup(View view) {
//revmob.showPopup(this);
RevMobPopup popup = revmob.createPopup(this, revmobListener);
popup.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment