Untiy Access Mobile mm detailed

Source: Internet
Author: User

Original address: http://www.cnblogs.com/alongu3d/p/3627936.html

Untiy Access Mobile mm detailed

First received the task of the Master (Dragons), ready to hand-written untiy access to the third-party SDK article (Android direction), the first write so bad place do not spit groove. If interested can add 63438968 (untiy Development Group) to explore.

This article is mainly based on unity and Android engineering analysis. The second reason is that there are incompatibilities between the SDK platform and the Unity program, resulting in the lack of files after release. This article also provides a solution for everyone's reference.

Specific projects can be downloaded Dabigatran 63438968. If you have an art staff, add 185762832

20140324 Bears family-Koala Zongzong boss

An eclipse

1.1 After receiving access to which platform, the first thing to do is to log on to this platform website, download the latest SDK, follow the development document content to find out which code is the corresponding method. and build a new project, write your own method. The following moved mm (2.3.0) is described as an example.

Mobile mm Official website http://dev.10086.cn/iap/?action=down&areaid=1354082900

Development documentation within the project

1.2 After the download is complete, turn on the demo of the mobile mm. On the Android phone, first understand, and the corresponding code in the demo to find out.

1.3 You can write your own project once you're sure. Access Engineering There are several places to be aware of, first of all Jay Package, Jay package is the third party platform Jay Package:

Where Armeabi Mmbilling.2.3.0.jar is the mobile mm platform that must be placed (found in the Downloaded SDK), Android-support-v4.jay is automatically generated by the Android project.

Unit-classes.jar (can be found within the unity engine, if not found directly search Classes.jar) is Unity's Jay package

Note: Import method In addition to normal drag into the Libs, you can also Properties-java Build path-libraries-click on the "Add JARs ..." button, in the pop-up window, select the Jar file, but this method is based on the absolute path, Therefore, if the project is changed position, it will cause the jar to be found. It is therefore not recommended to take this approach.

1.4 After adding the completion jar, you need to add the necessary declaration files in the configuration file Androidmanifest.xml. (Can be found in demo if needed)

Note: The above is the preparatory work, specific AppID, APPKEY, paycode, and hardware billing software billing parameters. Login to the website to register and develop the application to get the appropriate parameters.

1.5 Ready to develop. The following instructions do not show the code for example.

1.5.1 First, you need to inherit the main activity unityplayeractivity

Note: Unityplayeractivity is inherited from the activity

1.5.2 ready to access. Initialized as an example:

Private String mappid = "000000000000";

Private String Mappkey = "0000000000000000";

public void Init (String appid,string APPKEY) {

Mappid=appid;

Mappkey=appkey;

LOG.I ("ZD", "AppID" +mappid+ "Appkey" +mappkey);

Runonuithread (New Runnable () {

@Override

public void Run () {

Iaphandler Iaphandler = new Iaphandler (myactivity);

Mpaycode = Readpaycode ();

Mproductnum = Readproductnum ();

Mlistener = new Iaplistener (myactivity, Iaphandler);

Purchase = Purchase.getinstance ();

try {

Purchase.setappinfo (Mappid, Mappkey);

} catch (Exception E1) {

E1.printstacktrace ();

}

try {

Purchase.init (myactivity, Mlistener);

} catch (Exception e) {

E.printstacktrace ();

Return

}

}

});

}

Note:

Mappid, Mappkey need to come in unity incoming.

Because unity falls out of the SDK platform code, it uses the main thread and modifies the UI, but most of the time there is a fatal error when modifying the main UI, so it needs to be added to the child thread. Adding a child thread now summarizes three ways for everyone to refer to.

One: Runonuithread (new Runnable () {

@Override

public void Run () {

TODO auto-generated Method Stub

}

});

Second: Private Handler myhandler=new Handler ()

{

public void Handlemessage (Message msg) {

Switch (msg.what) {

Case 0:

Break

Default

Break

}

}

};

Myhandler.sendemptymessage (0);

Its three:

New Handler (Looper.getmainlooper ()). Post (new Runnable () {

@Override

public void Run () {

}});

The above three methods can be implemented in the child thread to complete the logical processing. specific to see which use of the use of that does not unify.

1.6 You need to write a callback method after all the accesses have been completed. and returning to unity needs to use the

Unityplayer.unitysendmessage (Deductiontomonitor, deductionsuccess, result); Note: The three parameters are in string format, if you need to return other types to convert.

First parameter: The name of the Gameobject object within the untiy the name of the object in my unity project that needs to be handled logically is gameobject to change the deductiontomonitor to Gameobject.

Second parameter: Gameobject the name of the method in the object

The third parameter: result is the parameter returned, and different parameters are passed as needed.

1.7 Android Project After you have written the method, you need to pack Jay. The steps are as follows:

Project Right-click-export-jar file-next-browse (select the path to store)-finish

Note: The above is the Android project, the specific code dabigatran within the group share.

Second, Unity

2.1 Create a new unity project, and within the project the file name must be plugins (untiy boot order This is the third boot order, If the other file untiy is not accessed at the time of initialization) the file created within plugins Android is also the Android plugin. And then add the file

Add four files: Config file, bin (Android packaged Jay), Libs (Jay package for third-party Platform SDK) Res (resource file) all other useless things are erased, avoiding unknown problems.

2.2 Change Unity to Android engineering

Drew four dashes.

The first is the name of the company after publication

The second is the name of the app after publishing

The third is the Android project package name, must be consistent, otherwise it will be problematic. If you don't know what to open in Androidmanifest:

The four is two parameters one is ARMv7 ARMv6 which ARMV6 is the low-end machine meaning, currently in the untiy version 3.5.6 still exist, later this option is no longer available. For low-end machines, if you do not choose ARMv6 to publish Android apps, the low-end machine will not work.

More than 2.3 is Unity's readiness to write unity off the Android code after doing it

Also just for example, please download the code in the group share

Note: Using is a C # method that is useful for new objects in the using (), which are automatically closed and freed at the end of the {}, and do not need to be done manually.

One: Androidjavaclass JC = new Androidjavaclass ("Com.unity3d.player.UnityPlayer")

Androidjavaclass English Direct Italian Android Java class. in parentheses.

Com.unity3d.player.UnityPlayer represents the path of the Android project Com.unity3d.player.UnityPlayer is the total path meaning,

If the modification can be modified to the Android package name + class name is also possible for example

You can modify the Com.unity3d.player.UnityPlayer to

Com.example.ydmmtext.Demo

Secondly: androidjavaobject Jo = JC. Getstatic<androidjavaobject> ("CurrentActivity")

The name of the Androidjavaobject Androidjava object can be specified, such as: point to when initializing

myactivity=unityplayer.currentactivity;

Not very well written, if interested to visit

Http://www.cnblogs.com/U-tansuo/archive/2013/03/13/unity3d_android_2.html

Neyo Introduction

Its three

Jo. Call ("Init", Appid,appkey);

It means to access the Init method within the Android project and pass two parameters.

Android Engineering for code

This allows unity to access the Android project.

2.4 Callback: In many cases, when Unity calls Android, Android also needs to return to unity information, such as whether the user paid successfully, failed to pay, or canceled after the payment. Need to be returned to unity and be logically handled accordingly.

2.4.1 in Android Engineering

and unity corresponds to the code that is

This will enable Android callback unity

2.5 After the call and callback methods have been written. To share a factory code that facilitates calls between unity Code,

If the call is made, direct ydmm.  Instance.init (Appid,appkey); Can

2.6 You can publish it after you finish writing it. However, in the release of the issue is often unable to publish the APK, the problem is more than the bin Libs res three files, not more files or less files. Causes resources to not be found and so on. Pay more attention to the development documents of each platform.

Third, after the release of the APK is also done. But some SDK platforms such as mobile MM, multi-League, Baidu Mobile Alliance, there are compatibility issues, that is, in the APK root directory, the files are not automatically generated, and this time you need to manually add. How to find missing files, you can open the corresponding SDK platform to find the demo this demo project will have eclipse auto-generated apk. Change his suffix to zip to find missing files

After changing to zip, opening will find some more files in the root directory, and the APK after unity has not

You will need to manually copy the missing files to your apk.

3.2 Added after the operation has not been completed, because Android has its own signature system, without giving this signature to add things, will cause the phone does not know the program, so after the addition of the add-on will need to re-sign the APK, signing software has a lot. Do not introduce too much. A signature software is provided in this group for everyone to use.

Note: Mobile mm in all access after the completion of the mobile MM platform can be published, but in the release of the issue will be encountered can not be uploaded, I also encountered the issue when publishing, and later changed a browser to solve the problem. You can do this if you have a similar problem.

Four, the above is the mobile mm access. Here's what to update later

4.1 If not, you can ask questions within the group

More than 4.2 content includes advertising, SMS payment, internal payment follow-up will be gradually updated to improve, as well as the vast number of friends consulting how to better access to a number of SDK platform. This piece is not very familiar at the moment. At the same time access to 8 SKD, but is carried out one by one integration, very inconvenient management. Seek out the user to teach, simplifies the access method. Here are the contact information and the link addresses of the major platform SDKs:

Development Group number: 63438968 Blog address: http://www.cnblogs.com/alongu3d/

Designer Group: 185762832

Yu Song Momo blog address: http://www.xuanyusong.com/18th and 19 tablets if it is a beginner's suggestion to look.

Tapjoy_sdk

Https://dashboard.tapjoy.com/sdk

Have rice ads

Http://www.youmi.net/apps/sdk

Google Admob

Https://developers.google.com/mobile-ads-sdk/docs/dfp/fundamentals#play

Adsage

http://mobi.adsage.cn/ac/?adsage_ticket=eyJ0b2tlbiI6IjI3YTkxMjU1OWY5ZjVlYjRmOWU4MTg0OGI3ZDI2NmE4IiwiaG9zdCI6InJzdnIzIn0=

Mobile game Base

Version needs to find customer service to http://g.10086.cn/spbbs/search.php

Telecom Love Games

Version needs to find customer service to

Google Play on-site payments

Http://prime31.com/plugins

DOMOB Multi-League AD

Http://www.domob.cn/developers/SDKdownload.htm

DOMOB Multi-League integration wall

Http://www.domob.cn/developers/SDKdownload.htm

Sina Weibo

Http://open.weibo.com/wiki/SDK#Android_SDK

Sdk

Http://open.weixin.qq.com/document/gettingstart/android/

Unicom VAC

Need to find an interface person

Jifeng Payment

http://www.gfan.com/dev/gpay/

360 Mobile Games SDK

Http://openapi.360.cn/page/sdk_cms

Baidu Mobile Alliance Advertising

Http://munion.baidu.com/about.html#/sdk/mobSdk

Baidu Mobile Alliance Integration Wall

Http://munion.baidu.com/about.html#/sdk/statSdk

moving mm

http://dev.10086.cn/iap/?action=down&areaid=1354082900

Du Midi

Http://www.miidi.net/static/developers/sdk.htm

Smartmad Yi Zhi Dao

Http://ads.smartmad.com/selfservice/app/downloadList.m

91SDK

Http://bbs.18183.com/forum-91sdk-1.html

Ucsdk

Http://bbs.9game.cn/thread-3183827-1-1.html

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.