Unity3D Baidu Duoku 1.1.0 업데이트 작업 변경 사항

 중국 마켓들이 자꾸 게임 출시전에 SDK를 업데이트하네요. 전에는 91SDK가 3.2.5로 업데이트 한걸 적용해 달라고 하더니 이번에는 바이두 Duoku SDK가 출시직전 업데이트 되서 왔네요.

Description Resource Path Location Type
The method dkAppVersionUpdate(Activity, new DkProCallbackListener.OnAppVersionUpdateListener<Integer>(){}) is undefined for the type DkPlatform DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 173 Java Problem
The method dkUniPayForCoin(Activity, int, String, String, int, String, DkProCallbackListener.OnExitChargeCenterListener) in the type DkPlatform is not applicable for the arguments (Activity, String, String, String, String, String) DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 166 Java Problem
The method dkSetSessionInvalideListener(new DkProCallbackListener.OnSessionInvalidListener(){}) is undefined for the type DkPlatform DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 243 Java Problem
The method dkSetOnLoginPageDestroyedListener(new DkProCallbackListener.OnLoginPageDestroyedListener(){}) is undefined for the type DkPlatform DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 217 Java Problem
The method dkSetExitPlatformListener(DkProCallbackListener.OnExitChargeCenterListener) from the type DkPlatform is not visible DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 257 Java Problem
The type new DkProCallbackListener.OnExitChargeCenterListener(){} must implement the inherited abstract method DkProCallbackListener.OnExitChargeCenterListener.doOrderCheck(boolean, String) DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 257 Java Problem
The method onPlatformBackground() of type new DkProCallbackListener.OnExitChargeCenterListener(){} must override or implement a supertype method DuokuHandler.java /PluginChina91DKUC/src/com/kabod/DungeonBreaker/uc line 260 Java Problem

 SDK jar 파일만 교체하고 빌드하면 위와 같은 에러가 발생하는데 다 SDK 딴에서 삭제되거나 다른 API에 통합된 것들입니다. 1.1.0 적용하는 것을 자바딴만 정리해보겠습니다.


1. 삭제

 제가 샘플로 정리했던 것 중에서 DuokuUpdateApp, DuokuSessionListener, DuokuExitChargeCenterListener, DuokuLoginPageDestroyedListener를 삭제합니다.


2. 수정

// 로그인 취소                                                                  
case DkErrorCode.DK_LOGIN_CANCELED:                                              
Log.d(LOG_TAG, "DK_LOGIN_CANCELED");                                            
break;

 DuokuLoginPageDestroyedListener 이 삭제되면서 dkLogin의 OnLoginProcessListener의 콜백으로 위와같이 DK_LOGIN_CANCELED를 작업해줍니다.



//1.1.0 int로 변경 및 결제 페이지 종료 리스너 OnExitChargeCenterListener를 인자로 넘긴다.
//DkPlatform.getInstance().dkUniPayForCoin(UnityPlayer.currentActivity, iExchangeRatio, strMoneyName, strOrderSerial, iAmount, strDesc);

DkPlatform.getInstance().dkUniPayForCoin(UnityPlayer.currentActivity, iExchangeRatio, strMoneyName, strOrderSerial, iAmount, strDesc, new OnExitChargeCenterListener()
{
@Override
public void doOrderCheck(boolean arg0, String arg1) {
// TODO Auto-generated method stub
Log.d(LOG_TAG, "dkUniPayForCoin doOrderCheck?" + arg0 + arg1 );
JSONObject jsonObj = new JSONObject();

try {
//1.1.0 추가. needcheck가 true로 올 결우 구매 상태 체크를 해야한다.
jsonObj.put("needcheck", arg0);
jsonObj.put("orderserial", arg1);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

UnityPlayer.UnitySendMessage("PluginDuokuManager", "DuokuPaymentViewEnd_J", jsonObj.toString());
}
});

UnityPlayer.UnitySendMessage("PluginDuokuManager", "DuokuPaymentResult_J", this.strOrderSerial);
}

 1.1.0에서 삭제된 DuokuExitChargeCenterListener는 dkUniPayForCoin에 처리하게 변경되었습니다. 위와같이 마지막 인자에 리스너를 추가해주시고 bool형 변수인 needcheck에 따라 예외 처리를 하면 되겠습니다. 또한 dkUniPayForCoin의 인자도 모두 string값에서 ExchangeRatio와 amount가 int로 변경되었습니다.


3. 추가

private void DuokuAccountManager() {
Log.d(LOG_TAG, "DuokuAccountManager");
DkPlatform.getInstance().dkAccountManager(UnityPlayer.currentActivity);
}

 바이두 AccountManager라는 api가 추가되었습니다.


4. AndroidManifest

FATAL EXCEPTION: Thread-1041
java.lang.Error: FATAL EXCEPTION [Thread-1041]
Unity version     : 4.1.2f1
Device model      : Acer A500
Device fingerprint: acer/a500_ww_cus1/picasso:4.0.3/IML74K/1336617649:user/release-keys
Caused by: java.lang.SecurityException: Permission Denial: requires permission android.permission.WRITE_SETTINGS
at com.baidu.a.a.a.b.b.a(Unknown Source)
at com.baidu.a.a.a.b.b.a(Unknown Source)
at com.baidu.a.a.a.b.a.b(Unknown Source)
at com.baidu.a.a.a.b.a.a(Unknown Source)
at com.baidu.mobstat.b.f(Unknown Source)
at com.baidu.mobstat.c.a(Unknown Source)
at com.baidu.mobstat.c.b(Unknown Source)
at com.baidu.mobstat.b.a(Unknown Source)
at com.baidu.mobstat.k.run(Unknown Source)

 빌드 후 실행시 위와 같이 에러가 발생할 수 있는데 <uses-permission android:name="android.permission.WRITE_SETTINGS"/> 을 추가해줍니다.


<!-- Duoku -->
        <meta-data android:name="DUOKUSDK_CHANNEL"
           android:value="700" />
        <activity
            android:name="com.duoku.platform.ui.DKPaymentCenterActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:theme="@style/DK.Theme.NoBackGround"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKLoginActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:screenOrientation="landscape"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKAccountManagerActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:screenOrientation="landscape"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKLoginBdActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKRegisterActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKFindPwdHintActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:excludeFromRecents="true"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKLicenceActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:excludeFromRecents="true"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKReqBindPhoneActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:excludeFromRecents="true"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation"
            android:screenOrientation="landscape">
        </activity>
        <activity
            android:name="com.duoku.platform.ui.DKFindPwdActivity"
            android:configChanges="orientation|keyboardHidden|navigation"
            android:screenOrientation="landscape"
            android:theme="@style/DK.Theme.NoBackGround.NoAnimation">
        </activity>

 AndroidManifest의 액티비티는 위와 같이 수정 추가해줍니다. 기존보다는 간결해졌네요.

 마지막으로 당연히 바이두 Duoku SDK의 res 디렉터리의 것들도 플러그인 폴더에 갱신을 해줘야합니다.

댓글

이 블로그의 인기 게시물

'xxx.exe' 프로그램을 시작할 수 없습니다. 지정된 파일을 찾을 수 없습니다.

goorm IDE에서 node.js 프로젝트로 Hello World Simple Server 만들어 띄워보기

애드센스 수익을 웨스턴 유니온으로 수표대신 현금으로 지급 받아보자.