Android Note: details about the release of various advertisement platforms for apps

Source: Internet
Author: User

There are many Android advertising platforms and different markets have different levels of acceptance for each platform. Android Developers should consider the following two issues if they want to integrate advertising:
(1) What advertisements are integrated to make money?
(2) What advertisements are integrated and will not be rejected by the market?
The final result is often a compromise.
The first problem is the judgment of the advertising platform. I have no right to comment. This article focuses on the second problem.
The solution is to package different advertisement platform versions of the application. This article will discuss related topics one by one.

1. Basics
This article is for Android Note: App modularization and engineering expansion applications and Android note: app automation is an extension and application scenario in the multi-channel packaging Usage Details of Ant compilation projects.
Therefore, the basics of these two articles are also required:
(1) Application of the Android class library
(2). This step is optional if you want to manually update the compiled and packaged scripts because you need to automatically compile various market versions.

2. Selection of advertising platforms
Let me take three platforms as an example: wanpu, youmi, and orange.
Here I emphasize that I do not advertise. I do not recommend these three platforms, but I just use the three platforms as an example. At the same time, I also want to scold these advertising platforms, drag fees, and deduct the amount.
Why choose these three platforms?
(1 ). wanpu has a relatively high unit price, a large number of applications, and a good income. Many developers choose this platform. However, because of the user experience and points wall issues pushed before, wanpu has been banned by many markets, which is very typical.
(2 ). youmi, the promotion is good, but it is generally reflected that the income is low. banner advertisements and integral walls are separated, so the banner part can be taken out separately and published to some markets with strict requirements.
(3 ). orange, I don't know much about it for the time being. There is a credit wall, and it seems that the payment is relatively positive. Many new platforms are very active at the beginning (just pick a new platform to accompany it)
Some people say that using aggregation can use different ad platforms. I think this is totally different from the two discussed in this article. Five thousand words are omitted here.

3. integrated architecture
Before discussing the integration architecture, we must discuss the association between applications and advertisements:
(1). If there is a many-to-many relationship, an advertisement platform will certainly be embedded in many applications. An application often needs to release versions of multiple advertisement platforms.
(2 ). there is a one-to-many relationship, which is in conflict with the first one. However, the sdk of the advertising platform solves the problem of embedding in various applications, and many-to-many solutions must be considered, it will be very troublesome and has little value, so our focus is to release versions of multiple ad platforms for one application.
(3) first advertising, then application, and then advertising platform. This means that ad integration is taken into account at the beginning, but it is only a blank space, where the banner is displayed, where an application recommendation is displayed, and a blank method interface. Then, the application is developed; after the application is completed, consider how to integrate different advertising platforms, rewrite different advertising spaces based on different platforms, or display advertisements in different forms.
Under these considerations, I will draw the following integrated architecture diagram:

This architecture diagram is an example of a series of applications. Not only can each application publish multiple advertisement versions, but also a base library can encapsulate and customize multiple applications. This is a typical example.

4. Example
I have applied this idea to the world project. See https://github.com/openproject/world2.
And after verification, the effect is good.
Of course, I will skip the specific ad placeholder and overwrite here. You can also refer to the code above.

5. compilation problems
For different advertising platforms, we need to make some modifications to the automatic compilation and packaging script.
(1). Issue of ANT compilation for layer-3 projects: Issue of R. java file generation and resource packaging.
To emphasize this issue, we should remind you not to make a mistake.
R. java generation, the layer-3 project must be generated three times (build. xml ):

Copy codeThe Code is as follows: <echo> generating R. java for project to dir gen (using aapt)... </echo>
<Exec executable = "aapt">
<Arg value = "package"/>
<Arg value = "-m"/>
<Arg value = "-J"/>
<Arg value = "gen"/>
<Arg value = "-M"/>
<Arg value = "AndroidManifest. xml"/>
<Arg value = "-S"/>
<Arg value = "res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2.waps/res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2/res"/>
<Arg value = "-I"/>
<Arg value = "$ {android-jar}"/>
<Arg value = "-- auto-add-overlay"/>
</Exec>

<Echo> generating R. java for wap library project to dir gen (using aapt)... </echo>
<Exec executable = "aapt">
<Arg value = "package"/>
<Arg value = "-m"/>
<Arg value = "-- non-constant-id"/>
<Arg value = "-- auto-add-overlay"/>
<Arg value = "-J"/>
<Arg value = "gen"/>
<Arg value = "-M"/>
<Arg value = "../baseworld2.waps/AndroidManifest. xml"/>
<Arg value = "-S"/>
<Arg value = "res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2.waps/res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2/res"/>
<Arg value = "-I"/>
<Arg value = "$ {android-jar}"/>
</Exec>

<Echo> generating R. java for library to dir gen (using aapt)... </echo>
<Exec executable = "aapt">
<Arg value = "package"/>
<Arg value = "-m"/>
<Arg value = "-- non-constant-id"/>
<Arg value = "-- auto-add-overlay"/>
<Arg value = "-J"/>
<Arg value = "gen"/>
<Arg value = "-M"/>
<Arg value = "../baseworld2/AndroidManifest. xml"/>
<Arg value = "-S"/>
<Arg value = "res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2.waps/res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2/res"/>
<Arg value = "-I"/>
<Arg value = "$ {android-jar}"/>
</Exec>

This is also true for resource packaging. Pay special attention to the order of resource folders:
Copy codeThe Code is as follows: <echo> packaging resource (include res, assets, AndroidManifest. xml, etc.) to res.zip... </echo>
<Exec executable = "aapt">
<Arg value = "package"/>
<Arg value = "-f"/>
<Arg value = "-M"/>
<Arg value = "AndroidManifest. xml"/>
<Arg value = "-S"/>
<Arg value = "res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2.waps/res"/>
<Arg value = "-S"/>
<Arg value = "../baseworld2/res"/>
<Arg value = "-A"/>
<Arg value = "assets"/>
<Arg value = "-I"/>
<Arg value = "$ {android-jar}"/>
<Arg value = "-F"/>
<Arg value = "bin/res.zip"/>
<Arg value = "-- auto-add-overlay"/>
</Exec>

(2). Multi-Channel packaging and compilation script (build. sh)Copy codeThe Code is as follows :#! /Bin/bash

# Get the file parent dir
Basedir = $ (cd "$ (dirname" $0 ")"; pwd)

# Get project name by dir name
Project = $ (echo $ basedir | awk-F "/" '{print $ NF }')
Project =$ {project /\.*/}

# Enter the right parent dir
Cd $ basedir

# Markets = "waps google official appchina gfan qq nduo feiliu 3g 360 zhuamob baidu sohu 163 samsung coolmart meizu moto liantong iandroid imobile xiaomi nearme dev"
Markets = "mumayi eo dev"
For market in $ markets
Do
Echo packaging program project.v2.20.#market.apk...
Sed-I "s/\ (android: value = \)\"\(. * \) \ "\ (android: name = \" UMENG_CHANNEL \ "\)/\ 1 \" $ market \ "\ 3/g" AndroidManifest. xml
Sed-I "s/\ (android: value = \)\"\(. * \) \ "\ (android: name = \" YOUMI_CHANNEL \ "\)/\ 1 \" $ market \ "\ 3/g" AndroidManifest. xml
Sed-I "s/\ (android: value = \)\"\(. * \) \ "\ (android: name = \" WAPS_PID \ "\)/\ 1 \" $ market \ "\ 3/g" AndroidManifest. xml
Ant-Dapk-name = $ project-Dapk-version = v2.1-Dapk-market = $ market
Done

These two scripts are executed under app. waps. For general convenience, they can be placed somewhere, and then a soft link can be created using the ln command.

6. Summary
This article can be said to be fried leftovers, new bottles of old wine, so many places are a word, if you think thinking a little jump, haha, please read the relevant articles above.
This article uses previous knowledge to solve the problem of packaging multiple advertisement platform versions for applications. I have shared some notes and hope to help you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.