protected void logTimedEventBeginWithParams(JSONObject eventInfo) {
    LogD("logTimedEventBegin invoked!");
    final JSONObject curInfo = eventInfo;
    PluginWrapper.runOnMainThread(
        new Runnable() {
          @Override
          public void run() {
            try {
              String eventId = curInfo.getString("Param1");

              if (curInfo.has("Param2")) {
                JSONObject params = curInfo.getJSONObject("Param2");
                @SuppressWarnings("rawtypes")
                Iterator it = params.keys();
                Hashtable<String, String> paramMap = new Hashtable<String, String>();
                while (it.hasNext()) {
                  String key = (String) it.next();
                  String value = params.getString(key);
                  paramMap.put(key, value);
                }
                FlurryAgent.logEvent(eventId, paramMap, true);
              } else {
                FlurryAgent.logEvent(eventId, true);
              }
            } catch (Exception e) {
              LogE("Exception in logTimedEventBegin", e);
            }
          }
        });
  }
Beispiel #2
0
  private void showBannerAd(int sizeEnum, int pos) {
    final int curPos = pos;
    final int curSize = sizeEnum;

    PluginWrapper.runOnMainThread(
        new Runnable() {

          @Override
          public void run() {
            // destory the ad view before
            if (null != adView) {
              if (null != mWm) {
                mWm.removeView(adView);
              }
              adView.destroy();
              adView = null;
            }

            AdSize size = AdSize.BANNER;
            switch (curSize) {
              case AdsAdmob.ADMOB_SIZE_BANNER:
                size = AdSize.BANNER;
                break;
              case AdsAdmob.ADMOB_SIZE_IABMRect:
                size = AdSize.IAB_MRECT;
                break;
              case AdsAdmob.ADMOB_SIZE_IABBanner:
                size = AdSize.IAB_BANNER;
                break;
              case AdsAdmob.ADMOB_SIZE_IABLeaderboard:
                size = AdSize.IAB_LEADERBOARD;
                break;
              default:
                break;
            }
            adView = new AdView(mContext, size, mPublishID);
            AdRequest req = new AdRequest();

            try {
              if (mTestDevices != null) {
                Iterator<String> ir = mTestDevices.iterator();
                while (ir.hasNext()) {
                  req.addTestDevice(ir.next());
                }
              }
            } catch (Exception e) {
              LogE("Error during add test device", e);
            }

            adView.loadAd(req);
            adView.setAdListener(new AdmobAdsListener());

            if (null == mWm) {
              mWm = (WindowManager) mContext.getSystemService("window");
            }
            InterfaceAds.addAdView(mWm, adView, curPos);
          }
        });
  }
Beispiel #3
0
  @Override
  public void payForProduct(Hashtable<String, String> info) {
    LogD("payForProduct invoked " + info.toString());
    if (!networkReachable()) {
      payResult(InterfaceIAP.PAYRESULT_FAIL, "网络不可用");
      return;
    }

    final Hashtable<String, String> productInfo = info;
    PluginWrapper.runOnMainThread(
        new Runnable() {
          @Override
          public void run() {
            MobileSecurePayHelper mspHelper = new MobileSecurePayHelper(mContext);
            boolean bInstalled = mspHelper.detectMobile_sp();
            if (!bInstalled) {
              payResult(InterfaceIAP.PAYRESULT_FAIL, "未安装支付宝插件");
              return;
            }

            // start pay for this order.
            // 根据订单信息开始进行支付
            try {
              // prepare the order info.
              // 准备订单信息
              String orderInfo = getOrderInfo(productInfo);
              // 这里根据签名方式对订单信息进行签名
              String signType = getSignType();
              String strsign = sign(signType, orderInfo);
              // 对签名进行编码
              strsign = URLEncoder.encode(strsign);
              // 组装好参数
              String info = orderInfo + "&sign=" + "\"" + strsign + "\"" + "&" + getSignType();
              LogD("pay info : " + info);
              // start the pay.
              // 调用pay方法进行支付
              MobileSecurePayer msp = new MobileSecurePayer();
              boolean bRet = msp.pay(info, mHandler, AlixId.RQF_PAY, mContext);

              if (bRet) {
                // show the progress bar to indicate that we have started
                // paying.
                // 显示“正在支付”进度条
                closeProgress();
                mProgress = BaseHelper.showProgress(mContext, null, "正在支付", false, true);
              } else {
                payResult(InterfaceIAP.PAYRESULT_FAIL, "支付失败");
                return;
              }
            } catch (Exception ex) {
              LogE("Remote call failed", ex);
              payResult(InterfaceIAP.PAYRESULT_FAIL, "remote call failed");
              return;
            }
          }
        });
  }
 @Override
 public void stopSession() {
   LogD("stopSession invoked!");
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.onEndSession(mContext);
         }
       });
 }
 @Override
 public void setSessionContinueMillis(int millis) {
   LogD("setSessionContinueMillis invoked!");
   final int curMillis = millis;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.setContinueSessionMillis(curMillis);
         }
       });
 }
 @Override
 public void logTimedEventEnd(String eventId) {
   LogD("logTimedEventEnd invoked!");
   final String curId = eventId;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.endTimedEvent(curId);
         }
       });
 }
 @Override
 public void setCaptureUncaughtException(boolean isEnabled) {
   LogD("setCaptureUncaughtException invoked!");
   final boolean curEnable = isEnabled;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.setCaptureUncaughtExceptions(curEnable);
         }
       });
 }
 @Override
 public void logEvent(String eventId, Hashtable<String, String> paramMap) {
   LogD("logEvent(eventId, paramMap) invoked!");
   final String curId = eventId;
   final Hashtable<String, String> curParam = paramMap;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.logEvent(curId, curParam);
         }
       });
 }
 @Override
 public void logError(String errorId, String message) {
   LogD("logError invoked!");
   final String curID = errorId;
   final String curMsg = message;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.onError(curID, curMsg, "");
         }
       });
 }
Beispiel #10
0
  public IAPAlipay(Context context) {
    mContext = (Activity) context;
    mAdapter = this;

    PluginWrapper.runOnMainThread(
        new Runnable() {

          @Override
          public void run() {
            initUIHandle();
          }
        });
  }
 protected void logPageView() {
   LogD("logPageView invoked!");
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             FlurryAgent.onPageView();
           } catch (Exception e) {
             LogE("Exception in logPageView", e);
           }
         }
       });
 }
 protected void setReportLocation(boolean enabled) {
   LogD("setReportLocation invoked!");
   final boolean curEnable = enabled;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             FlurryAgent.setReportLocation(curEnable);
           } catch (Exception e) {
             LogE("Exception in setReportLocation", e);
           }
         }
       });
 }
Beispiel #13
0
 private void hideBannerAd() {
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           if (null != adView) {
             if (null != mWm) {
               mWm.removeView(adView);
             }
             adView.destroy();
             adView = null;
           }
         }
       });
 }
 protected void setVersionName(String versionName) {
   LogD("setVersionName invoked!");
   final String curVer = versionName;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             FlurryAgent.setVersionName(curVer);
           } catch (Exception e) {
             LogE("Exception in setVersionName", e);
           }
         }
       });
 }
 protected void setAge(int age) {
   LogD("setAge invoked!");
   final int curAge = age;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             FlurryAgent.setAge(curAge);
           } catch (Exception e) {
             LogE("Exception in setAge", e);
           }
         }
       });
 }
 protected void setUserId(String userId) {
   LogD("setUserId invoked!");
   final String curUser = userId;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             FlurryAgent.setUserId(curUser);
           } catch (Exception e) {
             LogE("Exception in setUserId", e);
           }
         }
       });
 }
 @Override
 public void setDebugMode(boolean isDebugMode) {
   isDebug = isDebugMode;
   final boolean curDebugMode = isDebug;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           FlurryAgent.setLogEnabled(curDebugMode);
           if (curDebugMode) {
             FlurryAgent.setLogLevel(Log.DEBUG);
           }
         }
       });
 }
  protected void setUseHttps(boolean useHttps) {
    LogD("setUseHttps invoked!");

    final boolean curCfg = useHttps;
    PluginWrapper.runOnMainThread(
        new Runnable() {
          @Override
          public void run() {
            try {
              FlurryAgent.setUseHttps(curCfg);
            } catch (Exception e) {
              LogE("Exception in setUseHttps", e);
            }
          }
        });
  }
 @Override
 public void startSession(String appKey) {
   LogD("startSession invoked!");
   final String curKey = appKey;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             Class.forName("android.os.AsyncTask");
           } catch (ClassNotFoundException e) {
             e.printStackTrace();
           }
           FlurryAgent.onStartSession(mContext, curKey);
         }
       });
 }
 protected void setGender(int gender) {
   LogD("setGender invoked!");
   final int curGender = gender;
   PluginWrapper.runOnMainThread(
       new Runnable() {
         @Override
         public void run() {
           try {
             byte bGender;
             if (1 == curGender) {
               bGender = Constants.MALE;
             } else {
               bGender = Constants.FEMALE;
             }
             FlurryAgent.setGender(bGender);
           } catch (Exception e) {
             LogE("Exception in setGender", e);
           }
         }
       });
 }
Beispiel #21
0
  public static void startpayproduct() {
    LogD("111111111startpayproduct start");
    PluginWrapper.runOnMainThread(
        new Runnable() {
          public void run() {
            McBaodianPay pay = McBaodianPay.init();
            pay.startPay(
                new OnStartPayListener() {

                  @Override
                  public void onQrCodePay() {
                    payByQrCode();
                  }

                  @Override
                  public void onBaodianPay() {
                    payByBaodian();
                  }
                });
          }
        });
  }