Esempio n. 1
0
 public static void onDestroy() {
   // PayWrapper.onPayResult(mAdapter, ret, msg);
   MagicCenter.unInit();
   LogD("Alipay result : ");
 }
Esempio n. 2
0
 public static void uninit() {
   Log.d("111", "111111111111111SDK uninit");
   MagicCenter.unInit();
 }
Esempio n. 3
0
 @Override
 public String getSDKVersion() {
   // return "Unknown version";
   return MagicCenter.getSdkVersion();
 }
Esempio n. 4
0
  @Override
  public void configDeveloperInfo(Hashtable<String, String> cpInfo) {
    LogD("initDeveloperInfo invoked " + cpInfo.toString());
    try {

      String strFlag = cpInfo.get("flag");
      LogD("1111111configDeveloperInfo  flag:" + strFlag);

      if (strFlag.equalsIgnoreCase("1")) {

        mAliPayTV_key = cpInfo.get("AliPayTV_key");
        mAliPayTV_secret = cpInfo.get("AliPayTV_secret");

        // LogD("1111111configDeveloperInfo  mAliPayTV_secret:"+ mAliPayTV_secret
        // +",mAliPayTV_key:"+mAliPayTV_key);

        // 检测盒子当前系统是否支持帐号授权
        if (!MagicCenter.isSupportAuthorize(mContext)) {
          McLog.d(
              "alipay2",
              "Sorry, this SDK doesn't support this system. You must install the latest account version.");
          LogD(
              "1111111Sorry, this SDK doesn't support this system. You must install the latest account version.");
          return;
        }

        MagicCenter.logSwitch(true);

        boolean isDebugMode = false;
        // 初始化sdk
        MagicCenter.init(
            mContext,
            mAliPayTV_key,
            mAliPayTV_secret,
            isDebugMode,
            new IInitListener() {
              @Override
              public void onInitFinish() {
                // TODO Auto-generated method stub
                McLog.d("alipay2", "init MagicCenter ok!!!");
                LogD("1111111init MagicCenter ok!!!");
              }

              @Override
              public void onInitError(int errCode) {
                // TODO Auto-generated method stub
                McLog.d(
                    "alipay2",
                    "Init MagicCenter error. code:"
                        + errCode
                        + " msg:"
                        + AliBaseError.getErrMsg(errCode));
                LogD(
                    "111111Init MagicCenter error. code:"
                        + errCode
                        + " msg:"
                        + AliBaseError.getErrMsg(errCode));
              }
            });

        // 设置监听
        MagicCenter.setAuthListener(
            new McUser.IAuthListener() {

              @Override
              public void onError(int arg0, String arg1) {
                // TODO Auto-generated method stub
                LogD("1111111setAuthListener MagicCenter error!!!");
                payResult(PayWrapper.PAYRESULT_FAIL, "登录监听失败,请重新购买!");
              }

              @Override
              public void onAuthSucess(int arg0) {
                // TODO Auto-generated method stub
                LogD("1111111setAuthListener MagicCenter ok,start pay!!!");

                // startpayproduct();
                payByBaodian();
              }
            });
      }

    } catch (Exception e) {
      LogE("Developer info is wrong!", e);
    }
  }