| | |
| | | package com.secondworld.sdk; |
| | | |
| | | public class BtGamePlatform extends PlatformDiff { |
| | | |
| | | @Override |
| | | public String platformName() { |
| | | return "hygame"; |
| | | } |
| | | |
| | | @Override |
| | | public String platformProductCode() { |
| | | return "84324345567485956654600331002691"; |
| | | } |
| | | |
| | | @Override |
| | | public String platformProductKey() { |
| | | return "12355811"; |
| | | } |
| | | } |
| | | package com.secondworld.sdk;
|
| | |
|
| | | import android.Manifest;
|
| | | import android.content.Context;
|
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bytedance.applog.AppLog;
|
| | | import com.bytedance.applog.InitConfig;
|
| | | import com.bytedance.applog.game.GameReportHelper;
|
| | | import com.bytedance.applog.util.UriConstants;
|
| | | import com.bytedance.hume.readapk.HumeSDK;
|
| | | import com.quicksdk.User;
|
| | | import com.secondworld.sdk.utils.LogUtil;
|
| | |
|
| | | import org.json.JSONException;
|
| | | import org.json.JSONObject;
|
| | |
|
| | | import java.util.Arrays;
|
| | |
|
| | | public class BtGamePlatform extends PlatformDiff {
|
| | |
|
| | | @Override
|
| | | public String platformName() {
|
| | | return "hygame";
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String platformProductCode() {
|
| | | return "84324345567485956654600331002691";
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String platformProductKey() {
|
| | | return "12355811";
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void CreateRoleEvent(String roleID)
|
| | | {
|
| | | GameReportHelper.onEventCreateGameRole(roleID);
|
| | | }
|
| | |
|
| | | //mount单位为分
|
| | | @Override
|
| | | public void PayEvent(String title, String goodsID, double mount)
|
| | | {
|
| | | //内置事件 “支付”,属性:商品类型,商品名称,商品ID,商品数量,支付渠道,币种,是否成功(必传),金额(必传)
|
| | | // 付费金额单位为元
|
| | | //mount为元,0.1折 需除以100获得真实金额,但抖音必须传元 向上取整,则充6分钱上报是1元 造成数据偏差
|
| | | int reportMoney = (int)Math.ceil(mount/100);
|
| | | LogUtil.i("unity", "reportMoney " + title + " " + reportMoney);
|
| | | GameReportHelper.onEventPurchase("gift", title, goodsID,1, "youxitu","¥", true, reportMoney);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void PrePayEvent(String title, String goodsID, double mount)
|
| | | {
|
| | | //关键行为
|
| | | JSONObject paramsObj = new JSONObject();
|
| | | try {
|
| | | paramsObj.put("origin_event", "prepay"); // 添加原始事件名称参数
|
| | | } catch (JSONException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | AppLog.onEventV3("game_addiction", paramsObj);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void OnCreate(Context var0)
|
| | | {
|
| | | String channel = "dy";
|
| | |
|
| | | /* 初始化SDK开始 */
|
| | | // 第一个参数APPID: 参考2.1节获取
|
| | | // 第二个参数CHANNEL: 填写渠道信息,请注意不能为空
|
| | | final InitConfig config = new InitConfig("520784", channel);
|
| | | // 设置数据上送地址
|
| | | config.setUriConfig(UriConstants.DEFAULT);
|
| | | config.setImeiEnable(false);//建议关停获取IMEI(出于合规考虑)
|
| | | config.setAutoTrackEnabled(true); // 全埋点开关,true开启,false关闭
|
| | | config.setLogEnable(false); // true:开启日志,参考4.3节设置logger,false:关闭日志
|
| | | AppLog.setEncryptAndCompress(true); // 加密开关,true开启,false关闭
|
| | | config.setMacEnable(false);
|
| | | config.setOperatorInfoEnabled(false);
|
| | | config.setEnablePlay(true);
|
| | | config.setAutoStart(false);
|
| | | //AppLog.init(var0, config, GameActivityProxy.I.activity);
|
| | | AppLog.init(var0, config);
|
| | | /* 初始化SDK结束 */
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public String[] platformPermission()
|
| | | {
|
| | | //return new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE};
|
| | | return new String[] {};
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void LoginSuccess()
|
| | | {
|
| | | LogUtil.i("unity", "LoginSuccess");
|
| | | GameReportHelper.onEventRegister("youxitu",true);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void StartRequestPermission()
|
| | | {
|
| | | //获取渠道名称 context为宿主的context
|
| | | String channel = HumeSDK.getChannel(GameAppProxy.app.getApplicationContext());
|
| | | if (channel == null || channel.isEmpty())
|
| | | {
|
| | | channel = "dy";
|
| | | }
|
| | | //获取humeSDK版本号
|
| | | String version = HumeSDK.getVersion();
|
| | |
|
| | | LogUtil.i("HumeSDK", "DYStart " + channel + " "+ version);
|
| | | AppLog.getInitConfig().setChannel(channel);
|
| | | AppLog.start();
|
| | | }
|
| | |
|
| | | }
|