예제 #1
0
  private void initSDK() {

    UmengUpdateAgent.setUpdateListener(
        new UmengUpdateListener() {
          @Override
          public void onUpdateReturned(int status, UpdateResponse updateResponse) {

            if (UmengUpdateAgent.isIgnore(SplashActivity.this, updateResponse)) {
              enterNext();
            } else {
              switch (status) {
                case UpdateStatus.Yes: // has update
                  break;
                case UpdateStatus.No: // has no update
                  enterNext();
                  break;
                case UpdateStatus.NoneWifi: // none wifi
                  Toast.makeText(SplashActivity.this, "网络异常", Toast.LENGTH_SHORT).show();
                  enterNext();
                  break;
                case UpdateStatus.Timeout: // time out
                  Toast.makeText(SplashActivity.this, "链接超时", Toast.LENGTH_SHORT).show();
                  enterNext();
                  break;
              }
            }
          }
        });
    UmengUpdateAgent.setDialogListener(
        new UmengDialogButtonListener() {

          @Override
          public void onClick(int status) {
            switch (status) {
              case UpdateStatus.Update:
                break;
              case UpdateStatus.Ignore:
                enterNext();
                break;
              case UpdateStatus.NotNow:
                enterNext();
                break;
            }
          }
        });

    //  友盟自动更新
    if (SharePreUtils.getsPreBoolean(this, "AutoUpdateFlag", true)) {
      UmengUpdateAgent.update(this);
    }
    // 静默下载更新
    if (SharePreUtils.getsPreBoolean(this, "SilentUpdateFlag", false)) {
      UIUtils.showToastSafe("静默下载更新");
      UmengUpdateAgent.silentUpdate(this);
    }
  }
예제 #2
0
 /** 进入下一个页面 */
 private void enterNext() {
   if (SharePreUtils.getsPreBoolean(SplashActivity.this, "GuideFlag", false)) {
     // 已经进入过引导页面
     startActivity(new Intent(SplashActivity.this, MainActivity.class));
   } else {
     // 没有进入过引导页面
     startActivity(new Intent(SplashActivity.this, GuideActivity.class));
   }
   finish();
 }