Android Panorama Advertising Access Tutorial

Panorama Advertising Access Tutorial

I believe everyone has met the need to add advertising in the app. Most of the way is to add advertising on the open page to attract users to click and jump.There are many advertisements on the market at present. Today we will introduce the simple integrated access of armoured advertisements.

sdk resource integration address

sdk download address

Access and precautions

1. Prepare

Create app IDs and ad space IDs on Panorama platforms.

2. Confusion

-keep class com.bytedance.sdk.openadsdk.** { *; }
-keep public interface com.bytedance.sdk.openadsdk.downloadnew.** {*;}
-keep class com.pgl.sys.ces.* {*;}

3. Import aar package

Copy the open_ad_sdk_2.5.3.2.aar and android-gif-drawable-1.2.6.aar packages from the downloaded resources to the project lib directory.
Add the following code to the project build.gradle

repositories {
    flatDir{
        dirs 'libs'
    }
	//perhaps
	flatDir {
    	dirs project(':app').file('libs')
    }
}

Add the following code to build.gradle under app

dependencies {
	//Pangolin Advertising
	implementation (name:'open_ad_sdk_2.5.3.2', ext: 'aar')
	//You must have the following package or you will get an error
	implementation (name:'android-gif-drawable-1.2.6', ext: 'aar')
}
//Signature configuration (this must be configured, otherwise it cannot be packaged)
signingConfigs {
    release {
        keyAlias 'xx'
        keyPassword 'xx'
        storeFile file('xx')
        storePassword 'xx'
    }
    debug {
        keyAlias 'xx'
        keyPassword 'xx'
        storeFile file('xx')
        storePassword 'xx'
    }
}

4.AndroidManifest.xml Configuration

Jurisdiction

<!--Required permissions-->
<uses-permission android:name="android.permission.INTERNET" />
<!--Optional permissions-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.GET_TASKS"/>
<!--Optionally, this privilege can only be added carefully after you declare to the developer that you want to get a location. Panorama will use this privilege for precision advertising-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!--If you have video-related advertisements and play them using textureView, be sure to add them, otherwise black screen-->
<uses-permission android:name="android.permission.WAKE_LOCK" />

application configuration

<!-- Pangolin -->
<provider
    android:name="com.bytedance.sdk.openadsdk.TTFileProvider"
    android:authorities="${applicationId}.TTFileProvider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/path" />
</provider>
<provider
    android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
    android:authorities="${applicationId}.TTMultiProvider"
    android:exported="false" />

file.xml file

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <!--To accommodate all paths you can set path = "." -->
    <external-path name="tt_external_root" path="." />
    <external-path name="tt_external_download" path="Download" />
    <external-files-path name="tt_external_files_download" path="Download" />
    <files-path name="tt_internal_file_download" path="Download" />
    <cache-path name="tt_internal_cache_download" path="Download" />
</paths>

5.sdk Initialization

Put the java file of the resource address downloaded above into the project and initialize it in the project Application file

ExecuteTaskManager.getInstance().init();
TTAdManagerHolder.init(this);

6. Use

Join Open Screen Advertising

ttAdUtil = new TTBannerAdUtil(this);
//Be sure to call before loading SplashAds again
ttAdUtil.setOnJumpToNext(() -> goMain());
ttAdUtil.loadSplashAd(mSplashContainer);

Join banner ads

ttAdUtil = new TTBannerAdUtil(this);
ttAdUtil.loadExpressAd("838486436", mExpressContainer, dWidth, dHeight);

Remember to close

@Override
protected void onDestroy() {
    if (ttAdUtil != null) {
        ttAdUtil.destroy();
    }
}

Note: For example, see the SplashActivity.java file in the download resource

Two original articles have been published. Approved 0. Visited 25
Private letter follow

Keywords: Android SDK xml Gradle

Added by gmcalp on Thu, 16 Jan 2020 04:26:49 +0200