-
Notifications
You must be signed in to change notification settings - Fork 0
Mavl Screen SDK v1.0.0 integrated guide
1.1 Copy mavl-screen-release-*.aar file into app/libs folder
1.2 Add mavl-screen-release-*.aar supported in build.gradle
repositories {
jcenter()
flatDir {
dirs './libs'
}
}
android {
dependencies {
implementation(name: 'mavl-screen-release-*.aar, ext: 'aar')
}
}
dependencies {
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.facebook.android:facebook-android-sdk:4.28.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}
由于Mavl Screen上面有广告,所以需要添加Mavl Mopub sdk支持,集成文档请见:
https://github.com/kevenzxd/GoodPractice/wiki/Mavl-sdk-V1.2.--integrated-guide
It's easy to use, only called MavlScreenManager.getInstance().init(Context, MavlScreenConfig) in your Application's onCreate().
4.1 Using default screen
MavlScreenManager.getInstance().init(this, new MavlScreenConfig.Builder()
.setAddedTime(addedTime)
.setBackgroundId(R.drawable.bg_screen)
.setAdId(Constants.MOPUB_ID_SCREEN)
.build());
4.2 Custom your screen
4.2.1 Create your SreenFragment
public class ScreenFragment extends ScreenBaseFragment {
@Override
protected ScreenAdConfig getAdConfig() {
AdViewBinder adViewBinder =
new AdViewBinder(R.layout.screen_native_ad_view, R.id.ad_image,
R.id.ad_icon, R.id.ad_title
, R.id.ad_desc, R.id.call_to_action, R.id.ad_choice);
return new ScreenAdConfig(Constants.MOPUB_ID_SCREEN, adViewBinder);
}
@Override
protected int getLayoutId() {
return R.layout.fragment_screen;
}
@Override
protected int getNativeAdContainerId() {
return R.id.native_ad_container;
}
}
4.2.2 Init
MavlScreenManager.getInstance().init(this, new MavlScreenConfig.Builder()
.withFragment(ScreenFragment.class.getName())
.setAddedTime(addedTime)
.setBackgroundId(R.drawable.bg_screen)
.build());
5.1 我们应用里锁屏launch的第一个前提条件是在不去广告的前提下,因此,init mavl screen sdk的时候仍要加此判断。
5.2 应用内付费购买后注意调用MavlScreenManager.getInstance().disableScreen(Context)去关闭锁屏功能。
5.3 在关闭锁屏功能的点击事件里调用MavlScreenManager.getInstance().disableScreen(Context)去关闭锁屏功能。
5.4 在打开锁屏功能的点击事件里调用MavlScreenManager.getInstance().enableScreen(Context)去打开锁屏功能。