|  |  |  | 
|---|
|  |  |  | import android.widget.Toast; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.allugame.freesdk.port.FreePlatform; | 
|---|
|  |  |  | import com.reyun.tracking.sdk.Tracking; | 
|---|
|  |  |  | import com.ss.android.common.applog.TeaAgent; | 
|---|
|  |  |  | import com.ss.android.common.applog.TeaConfigBuilder; | 
|---|
|  |  |  | import com.ss.android.common.lib.EventUtils; | 
|---|
|  |  |  | import com.unity3d.player.UnityPlayer; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.json.JSONException; | 
|---|
|  |  |  | 
|---|
|  |  |  | FreePlatformUtil.getInstace().payProcessing = true; | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case CodeU2A.PayFinished: | 
|---|
|  |  |  | Tracking.setPayment(_json.getString("orderID"), | 
|---|
|  |  |  | _json.getString("payType"), | 
|---|
|  |  |  | _json.getString("moneyType"), | 
|---|
|  |  |  | (float) _json.getDouble("money")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int _money = (int) (_json.getDouble("money")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | EventUtils.setPurchase("", | 
|---|
|  |  |  | "", | 
|---|
|  |  |  | "", | 
|---|
|  |  |  | 1, | 
|---|
|  |  |  | _json.getString("payType"), | 
|---|
|  |  |  | _json.getString("moneyType"), | 
|---|
|  |  |  | true, | 
|---|
|  |  |  | _money); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | FreePlatformUtil.getInstace().payProcessing = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case CodeU2A.ClientPackage: | 
|---|
|  |  |  | // 初始化热云 | 
|---|
|  |  |  | Tracking.initWithKeyAndChannelId(_activity, | 
|---|
|  |  |  | UniversalUtil.getMetaString(_activity, | 
|---|
|  |  |  | "TrackAppID"), | 
|---|
|  |  |  | _json.getString("clientPkgID")); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case CodeU2A.JPushAddLocalMessage: | 
|---|
|  |  |  | addLocalNotification(_activity, | 
|---|
|  |  |  | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case CodeU2A.JPushRemoveLocalMessage: | 
|---|
|  |  |  | removeNotification(_activity, _json.getInt("id")); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case CodeU2A.SendRegistEvent: | 
|---|
|  |  |  | FreePlatformUtil.getInstance().SendRegisterEvent(); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | // ------------------------------- 极光推送 ------------------------------- | 
|---|
|  |  |  | JPushInterface.setDebugMode(true); | 
|---|
|  |  |  | JPushInterface.init(activity); | 
|---|
|  |  |  | // ------------------------------- 今天头条 ----------------------- | 
|---|
|  |  |  | TeaAgent.init(TeaConfigBuilder.create(activity) | 
|---|
|  |  |  | .setAppName(UniversalUtil.getMetaString(activity, | 
|---|
|  |  |  | "TouTiao_AppName")) | 
|---|
|  |  |  | .setChannel(UniversalUtil.getMetaString(activity, | 
|---|
|  |  |  | "TouTiao_Chanel")) | 
|---|
|  |  |  | .setAid(UniversalUtil.getMetaInt(activity, "TouTiao_AppID")) | 
|---|
|  |  |  | .createTeaConfig()); | 
|---|
|  |  |  | TeaAgent.setDebug(true); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | final long _waitingTime = System.currentTimeMillis(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public static void onPause(final Activity activity) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FreePlatform.getInstance().onPause(); | 
|---|
|  |  |  | TeaAgent.onPause(activity); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static void onResume(final Activity activity) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FreePlatform.getInstance().onResume(); | 
|---|
|  |  |  | TeaAgent.onResume(activity); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(FreePlatformUtil.getInstace().payProcessing) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | public static void onDestroy(final Activity activity) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FreePlatform.getInstance().onDestory(); | 
|---|
|  |  |  | Tracking.exitSdk(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|