Integrated advertising in Korok games (Android platform)

Source: Internet
Author: User

These days our new game on the line, to tell the truth is quite fun. The first is the Mac version, the release of the Android version of the two days, the Android version of the profitability of the main consideration is advertising. Here is a record of some of our experience in integrating advertising.

The bottom of our game engine is packaged based on Gomobile, but Gomobile does not provide any way to integrate with third-party jar packages, although Java code can be called in Go->cgo-java Way, but new Java code cannot be added. The solution is very simple, create a new Android project directly, then bake the packaged .so files to the jniLibs catalog, then you can run the Android project directly.

The following are the specific implementation details:

    1. Create a new Android project
    2. Copy the Gonativeactivity.java from Gomobile to the new project
    3. Copy files packaged with Gomobile .so to the JNI directory
    4. Configure AndroidManifest.xml Activity to use replication

Compile and run, you can now find that Android projects are already happily running our Go project. .soand how did it come from? You can use it gobind or gomobile build .apk extract it directly from the package file.

The next step is to add ads, add ads to the process and add ads to normal Android projects without any difference. When we add ads to Gonativeactivity.java, it's important to note that the activity is inherited from a NativeActivity hierarchy with no view, and the general solution is to use a popupwindow to load the view of the ad.

In fact, it is very simple, in our implementation is probably such a few lines of code:

// 装在广告Viewpopup = new PopupWindow(this);popup.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));// bannerAdView adView = new AdView(this);popup.setContentView(adView);// 在屏幕下方显示广告popup.showAtLocation(getWindow().getDecorView(), Gravity.BOTTOM, 0, 0);

After you integrate your ads, you can pack your signatures like normal Android projects, not here.

In fact, this practice also gives us a way to do Android packaging, you can divide the project into Android and Golang parts, the use of a unified script package, so whether the Java or Go code changes can be used in the same packaging script to execute, The operation may be much simpler.

In addition, a few of our new games--**shoot Stack * * (very beautiful):


Shoot Stack

The resolution is a little lower, in fact the HD version is very good. Due to the domestic special reasons for the domestic market is not available, now on-line itch.io you can download to MAC version: shooting! Block by ntop or download Android version in GooglePlay: Android:shoot Stackplay.google.com

Googleplay.jpeg

Tubing Video: Https://youtu.be/MGd_QJ_nahU

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.