How to: Add an ad Method step to your Android app!

Source: Internet
Author: User

I'm going to add the pop-up menu (more apps and about 2 options) to the Settings button below the first photo-shoot button, display the ad wall in the more Apps menu, show an ad bar above the second graph interface, and push the ad because it doesn't occupy the ad interface, so don't worry about where it is. (Of course, when the final release I will be based on different publishing market to choose one of the 1-2 types of advertising, this is only for demonstration purposes, too many ads will make users disgusted)

Advertising Platform:

AD wall and push ads I use Wanpo, ad strips I use the mango aggregation, temporarily intend to use the multi-League, there are meters 2 platforms. (The reason to use more than one platform can be done in real-time online proportional distribution, so there is more choice, of course, not the more the better, add more platforms, the more bloated, your income is of course scattered, and each platform requires at least 100 yuan to withdraw.) )

Let's start by adding ad walls and push ads.

1. Login to the Wanpo platform, go to the Developer page, click Add App, enter the app name, click Save, then open the App details page and note the 2nd step of waps_id. The information in the back is also as perfect as possible.

File programs and so on the final completion of advertising integration and testing before uploading.

2. under the Androidmanifest.xml file of my project, add the required permissions for the ad (specifically what permissions to participate in the AD SDK help and the actual situation):

    1. <uses-permission android:name="Android.permission.READ_PHONE_STATE"/>
    2. <uses-permission android:name="Android.permission.INTERNET"/>
    3. <uses-permission android:name="Android.permission.WRITE_EXTERNAL_STORAGE"/>
    4. <uses-permission android:name="Android.permission.ACCESS_FINE_LOCATION"/>
    5. <uses-permission android:name="Android.permission.ACCESS_NETWORK_STATE"/>
    6. <uses-permission android:name="Android.permission.GET_TASKS"/>

Join in Application:

    1. <meta-data android:name="waps_id" android:value="2f9dd55307ede480a80ba0783be835d"/>
    2. <meta-data android:name="waps_pid" android:value="WAPs"/>
    3. <activity android:name="Com.waps.OffersWebView"
    4. android:configchanges="Keyboardhidden|orientation"/>

The first line android:value the corresponding string to replace step 1 from the Wanpo add an app to get the ID, do not fill the wrong oh.

The second line is WANPO for channel setup options, preferably in the form of the last corresponding table of their developer manual.

The third line is the activity used to display the ad wall, and not adding it will cause the ad wall to be displayed.

3.Eclipse->project->properties->java Build path->libraries->add External jars-> Select the Appoffer_1.5.3.jar that we downloaded earlier to complete the jar package to add the Wanpo SDK.

Add Appconnect.getinstance (this) to the processing event that corresponds to more application menus. Showoffers (this); To open the advertising wall.

Run the app, click More apps, open the recommended list

4. Open the entry activity for the project and write it in the OnCreate event

    1. Appconnect.getinstance (this);
    2. Appconnect.getinstance (this). Getpushad (); //Auto push use, if you configure auto push on the Wanpo Web side, you can annotate the second row

Write to the place where the app was exited (I was the OnDestroy event at the ingress activity)

    1. Appconnect.getinstance (this). Finalize ();

To run a push effect such as:

Click Notifications (push ads) to open

In this way we put Wanpo advertising wall and push mode of advertising integration, the application will use the official signature (method online Search Many, here does not introduce) after compiling the APK upload to the Wanpo audit, at the same time can be published to the market channel to let users download. (About market release in the next chapter)

here's how to add an ad strip using Mango aggregation:

1. Login to the Mango platform, add new apps, play * Must fill in, click Next to enter the ad Platform Selection page.

2. Add a new app to the ad platform you want to add to get the corresponding ID and set the ID to the 1-step mango platform corresponding to the ID setting ("Not set" after the point corresponding platform).

3. Click on the button on the back of the Mango page to open the status of the platform and click on the test to test to see if you can get the test ad correctly. At the same time, the ratio of 2 platforms is 50%.

4. Click Next and the app is finished. Will get a mango ID to spare, download the SDK for Mango ads. (Because the SDK already contains the jar packages for all of the platforms that it supports, there is no need to download the packages of other ad platforms separately, and the aggregation platform does not necessarily update all of the platform's packages in a timely manner, it may not change the SDK in time for the update of the ad platform, so it must also be from here)

5. Extract the SDK downloaded from the mango and add it to the Libs under the corresponding platform (i add adsmogo-sdk-android.jar[mango], youmi-android.jar[rice], domob_ android_sdk.jar[(multi-union]).

6. Modify the Androidmanifest.xml file, add the necessary permissions, and go to the Mango SDK Development help document to find the activity that the corresponding platform requires to add. I join here:

    1. <!--  integration --> 
    2.  
    3.  <activity android: Name= "cn.domob.android.ads.DomobActivity" &NBSP;
    4.  
    5.   android:theme= "@android: Style/theme.translucent" &NBSP;/>&NBSP;
    6.  
    7.  <!--  Rice integration --> 
    8.  
    9.  <activity android:name= "net.youmi.android.AdActivity" &NBSP;
    10.  
    11.   android:configchanges= "keyboard|keyboardhidden|orientation" &NBSP;/>&NBSP;
    12.  
    13.  <activity android:name= "net.youmi.android.spotad.AdActivity" &NBSP;
    14.  
    15.   android:configchanges= "keyboard|keyboardhidden|orientation" &NBSP;/>&NBSP;

7. Add the Meta-data of Mango key and replace the value you obtained at the end of the Mango platform with the key value, and my side is as follows:

    1. <meta-data android:value="25fff80a3966465e888e0db9735fef11" android:name="Admogo_key"/>

8. Add the following code where you want to show it:

    1. Admogolayout Adview = new Admogolayout (This,"25fff80a3966465e888e0db9735fef11"); //id the same as the XML configuration
    2. Framelayout.layoutparams params = new Framelayout.layoutparams (
    3. FrameLayout.LayoutParams.WRAP_CONTENT,
    4. FrameLayout.LayoutParams.WRAP_CONTENT);
    5. //Set where the ad appears (hover at the top)
    6. Params.topmargin = 0;
    7. Params.gravity = gravity.top| Gravity.center_horizontal;
    8. Addcontentview (Adview, params);

This code works by creating a new view of the Mango AD and adding it to the top of the activity.

9.OK, the code is added to complete, run the test, the ad normal display as follows:

If you click on the test, you can open the Ad page normally. Go to the Mango Web page to adjust the distribution ratio of your ad platform, and test all of your platforms for successful display. If there is a failure, please check the mango on the configuration of the ID or password is the same (including no space before and after), still have a problem contact the platform technician to help you solve.

The final step is to distribute the proportions on the Mango Web page evenly and turn off the test mode. The app signature is then packaged and uploaded to each ad platform for review. (The average distribution is for auditors to ensure they have the opportunity to see ads showing their platform on your app), and audits can be posted to each market to start earning journeys.

Technical recommendation:

    • Technology Blog: Love encryption There is no so library file Protection, is free encryption?
    • Technology Blog: Love encryption basic encryption and enterprise custom encryption What is the difference?
    • Technology Blog: How to encrypt a mobile app encryption issue. What about the Dex file?


How to: Add an ad Method step to your Android app!

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.