com.umeng.update.UmengUpdateAgent Java Examples

The following examples show how to use com.umeng.update.UmengUpdateAgent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ViewUtils.inject(this);
	init();
	initCheckBoxStatusAndSetListenner();
	UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
	    @Override
	    public void onUpdateReturned(int updateStatus,UpdateResponse updateInfo) {
	        switch (updateStatus) {
	        case UpdateStatus.Yes: // has update
	            UmengUpdateAgent.showUpdateDialog(UserCenterActivity.this, updateInfo);
	            break;
	        case UpdateStatus.No: // has no update
	            ToastUtils.showMessageInCenter(UserCenterActivity.this, "已是最新版本");
	            break;
	        case UpdateStatus.Timeout: // time out
	        	ToastUtils.showMessageInCenter(UserCenterActivity.this, "检测超时");
	            break;
	        }
	    }
	});
}
 
Example #2
Source File: MainActivity.java    From v2ex-daily-android with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    UmengUpdateAgent.update(this);

    getActionBar().setIcon(R.drawable.ic_logo);

    mNavigationDrawerFragment = (NavigationDrawerFragment)
            getFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
            R.id.navigation_drawer,
            (DrawerLayout) findViewById(R.id.drawer_layout));
}
 
Example #3
Source File: HomeActivity.java    From TitanjumNote with Apache License 2.0 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_home);
  // 绑定
  ButterKnife.bind(this);
  // 数据
  initData();

  // TODO 二期加入
  //initEvernote();
  // 适配器
  setupNoteAdapter();
  setupActionBar();
  setSearchViewListener();
  swipeBackFrameLayout.setCallBack(new SwipeBackFrameLayout.CallBack() {
    @Override public void onShouldFinish() {
      finish();
      overridePendingTransition(R.anim.no_anim, R.anim.out_to_right);
    }
  });

  UmengUpdateAgent.update(this);
}
 
Example #4
Source File: Configuration.java    From iSCAU-Android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onUpdateReturned(int updateStatus,UpdateResponse updateInfo) {
    switch (updateStatus) {
        case UpdateStatus.Yes: // has update
            UmengUpdateAgent.showUpdateDialog(getSherlockActivity(), updateInfo);
            break;
        case UpdateStatus.No: // has no update
            Toast.makeText(getSherlockActivity(), "没有更新", Toast.LENGTH_SHORT).show();
            break;
        case UpdateStatus.NoneWifi: // none wifi
            Toast.makeText(getSherlockActivity(), "没有wifi连接, 只在wifi下更新", Toast.LENGTH_SHORT).show();
            break;
        case UpdateStatus.Timeout: // time out
            Toast.makeText(getSherlockActivity(), "超时", Toast.LENGTH_SHORT).show();
            break;
    }
}
 
Example #5
Source File: MyUpdateListener.java    From wakao-app with MIT License 6 votes vote down vote up
@Override
public void onUpdateReturned(int updateStatus,
		UpdateResponse updateInfo) {
	switch (updateStatus) {
	case 0: // has update
		Log.i("--->", "callback result");
		UmengUpdateAgent.showUpdateDialog(mContext, updateInfo);
		break;
	case 1: // has no update
		Toast.makeText(mContext, "已经是最新版本", Toast.LENGTH_SHORT)
				.show();
		break;
	case 2: // none wifi
		Toast.makeText(mContext, "没有wifi连接, 只在wifi下更新", Toast.LENGTH_SHORT)
				.show();
		break;
	case 3: // time out
		Toast.makeText(mContext, "超时", Toast.LENGTH_SHORT)
				.show();
		break;
	case 4: // is updating
		/*Toast.makeText(mContext, "正在下载更新...", Toast.LENGTH_SHORT)
				.show();*/
		break;
	}
}
 
Example #6
Source File: AboutFragment.java    From AppPlus with MIT License 6 votes vote down vote up
@Override
public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
    switch (updateStatus) {
        case UpdateStatus.Yes: // has update
            UmengUpdateAgent.showUpdateDialog(mContext, updateInfo);
            break;
        case UpdateStatus.No: // has no update
            DialogUtil.showSinglePointDialog(mContext,mContext.getString(R.string.update_point_no_update));
            break;
        case UpdateStatus.NoneWifi: // none wifi
            DialogUtil.showSinglePointDialog(mContext, mContext.getString(R.string.update_point_no_wifi));
            break;
        case UpdateStatus.Timeout: // time out
            DialogUtil.showSinglePointDialog(mContext, mContext.getString(R.string.update_point_time_out));
            break;
    }
}
 
Example #7
Source File: MainActivity.java    From GankMeizhi with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("ConstantConditions")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        UmengUpdateAgent.update(this);
        setSupportActionBar(toolbar);

        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        setupDrawerContent(navigationView);

        setupViewPager(viewPager);
        viewPager.setCurrentItem(getIntent().getIntExtra(EXTRA_FRAG_TYPE, DEFAULT_FRAG));
        tabLayout.setupWithViewPager(viewPager);
//        startService(new Intent(this, PrefetchService.class));
    }
 
Example #8
Source File: HomeActivity.java    From Moring-Alarm with Apache License 2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    /*requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);*/
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    //判斷是否是新用戶
    if(PrefUtils.getBoolean(this,ConsUtils.IS_FIRST_TIME,true)){
        startActivity(new Intent(this,GuideActivity.class));
        finish();
        return;
    }
    UmengUpdateAgent.update(this);
    //初始化数据库
    initDataBase("china_Province_city_zone.db");
    initSlideMenu();
    initView();
    initFragment();
    initService();
    Intent intent=getIntent();
    if(intent.getBooleanExtra("showGuide", false)){
        firstTimeGuide();
    }

}
 
Example #9
Source File: BaseActivity.java    From iZhihu with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // setTheme(android.R.style.Theme_Holo_Light);

    actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setIcon(android.R.color.transparent);

    context = getApplicationContext();
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);

    try {
        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    openAnalytics = mSharedPreferences.getBoolean(getString(R.string.key_analytics), true);
    if (openAnalytics) {
        MobclickAgent.onError(this);
    }

    UmengUpdateAgent.update(this);
}
 
Example #10
Source File: MainActivity.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
public void checkUpdate() {
	UmengUpdateAgent.setUpdateAutoPopup(false);
	UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
		
		@Override
		 public void onUpdateReturned(int updateStatus,UpdateResponse updateInfo) {
	        switch (updateStatus) {
	        case UpdateStatus.Yes: // has update
	            UmengUpdateAgent.showUpdateDialog(MainActivity.this, updateInfo);
	            break;
	        case UpdateStatus.No: // has no update
	        	showMsg("当前已是最新版本"+SF.TIP);
	            break;
	        case UpdateStatus.Timeout: // time out
	        	showMsg("检测超时"+SF.FAIL);
	            break;
	        }
	        UmengUpdateAgent.setUpdateAutoPopup(true);
			UmengUpdateAgent.setUpdateListener(null);
	    }
	});
	showMsg("检测更新中,请稍候...");
	UmengUpdateAgent.update(this);
}
 
Example #11
Source File: AboutFragment.java    From AppPlus with MIT License 5 votes vote down vote up
@Override
    public boolean onPreferenceClick(android.preference.Preference preference) {
        String key = preference.getKey();
        //用if判断 效率不会很好 待改善
        if(key.equals(getString(R.string.preference_key_about))){
            String htmlFileName =  Utils.isChineseLanguage()?"about_ch.html":"about.html";
            DialogUtil.showCustomDialogFillInWebView(mContext, mContext.getSupportFragmentManager(), getString(R.string.preference_title_about), htmlFileName, "about");
            MobclickAgent.onEvent(mContext, "setting_about");
        }
        if(key.equals(getString(R.string.preference_key_score))){
//            NavigationManager.gotoMarket(mContext,getActivity().getPackageName());
            AppRate.with(getActivity()).showRateDialog(getActivity());
            MobclickAgent.onEvent(mContext, "setting_market");
        }
        if(key.equals(getString(R.string.preference_key_opinion))){
            NavigationManager.gotoSendOpinion(getActivity());
            MobclickAgent.onEvent(getActivity(), "send_email");
        }
        if(key.equals(getString(R.string.preference_key_check_update))){
            UmengUpdateAgent.setUpdateListener(new CheckUmengUpdateListener());
            UmengUpdateAgent.forceUpdate(mContext);
            MobclickAgent.onEvent(mContext, "setting_check_update");
        }
        if(key.equals(getString(R.string.preference_key_license))){
            DialogUtil.showCustomDialogFillInWebView(mContext, mContext.getSupportFragmentManager(), getString(R.string.preference_title_license), "license.html", "license");
            MobclickAgent.onEvent(mContext, "setting_license");
        }
        return false;
    }
 
Example #12
Source File: Configuration.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
@Click
void btn_update(){
    AppMsg.makeText(getSherlockActivity(),
            app.getString(R.string.tips_checking_for_update)
            , AppMsg.STYLE_INFO).show();
    UmengUpdateAgent.setUpdateAutoPopup(false);
    UmengUpdateAgent.setUpdateListener(umengUpdateListener);
    UmengUpdateAgent.forceUpdate(getSherlockActivity());
}
 
Example #13
Source File: MainActivity.java    From WeCenterMobile-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	sharedPreferences = new FanfanSharedPreferences(MainActivity.this);
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowHomeEnabled(false);
	if (!sharedPreferences.getLogInStatus(false)) {
		draweritems = this.getResources().getStringArray(
				R.array.nologindrawerliststring);
	} else {
		draweritems = this.getResources().getStringArray(
				R.array.drawerliststring);
		// Login();
	}
	mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager()
			.findFragmentById(R.id.navigation_drawer);
	mTitle = getTitle();

	// Set up the drawer.
	mNavigationDrawerFragment.setUp(R.id.navigation_drawer,
			(DrawerLayout) findViewById(R.id.drawer_layout));
	// ���������Զ��������
	UmengUpdateAgent.update(MainActivity.this);
	// �û���������̨����Ƿ����µ����Կ����ߵĻظ���
	FeedbackAgent mAgent = new FeedbackAgent(MainActivity.this);
	mAgent.sync();
	MobclickAgent.updateOnlineConfig(MainActivity.this);
}
 
Example #14
Source File: MyDevicesListFragment.java    From freeiot-android with MIT License 5 votes vote down vote up
public void initView(View rootView) {
        mSwipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_container);
        mSwipeRefreshLayout.setColorScheme(R.color.main_red_color);
        mSwipeRefreshLayout.setOnRefreshListener(this);
        mSwipeRefreshLayout.setProgressViewOffset(true, 0, UIUtils.dip2px(getActivity(), 48));
        mListView = (ListView) rootView.findViewById(R.id.listview);

        LocalBroadcastManager.getInstance(getActivity())
                .registerReceiver(refreshDevicesReceiver,
                        new IntentFilter(ActionConstants.ACTON_REFRESH_DEVICES));
        refreshDevices(true);
//		UpdateConfig.setDebug(true);
        UmengUpdateAgent.forceUpdate(getActivity());
    }
 
Example #15
Source File: WelcomeAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
public void operateUmeng() {
	UmengUpdateAgent.setUpdateUIStyle(UpdateStatus.STYLE_NOTIFICATION);
	UmengUpdateAgent.setDeltaUpdate(true);
	UmengUpdateAgent.setUpdateOnlyWifi(false);
	UmengUpdateAgent.update(this);
	//检测开发者反馈回复
	FeedbackAgent agent = new FeedbackAgent(this);
	agent.sync();
}
 
Example #16
Source File: MainActivity.java    From school_shop with MIT License 5 votes vote down vote up
private void initView(){
		mToolbar = (Toolbar) findViewById(R.id.toolbar);
		mToolbar.setTitle(getResources().getString(R.string.app_name));// 标题的文字需在setSupportActionBar之前,不然会无效
		
		setSupportActionBar(mToolbar);
		
		/* 菜单的监听可以在toolbar里设置,也可以像ActionBar那样,通过下面的两个回调方法来处理 */
//		mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				switch (item.getItemId()) {
//				case R.id.action_search:
//					Toast.makeText(MainActivity.this, "action_settings", 0).show();
//					break;
//				default:
//					break;
//				}
//				return true;
//			}
//		});
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		mNavigationDrawerFragment = (NavigationDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
		mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
		//设置侧滑
		mNavigationDrawerFragment.setUp(R.id.navigation_drawer,mDrawerLayout,mToolbar);
		MyApplication.initScreen(this);

        //检查更新
        UmengUpdateAgent.update(this);
	}
 
Example #17
Source File: BaseActionBarActivity.java    From the-tech-frontier-app with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mFragmentManager = getSupportFragmentManager();
    MobclickAgent.onResume(this);
    UmengUpdateAgent.update(this);
}
 
Example #18
Source File: RLUpdateHelper.java    From Roid-Library with Apache License 2.0 5 votes vote down vote up
/**
 * @param context
 * @param isQuietly
 */
public static void checkUpdate(final Context context, final boolean isQuietly) {
    final RLLoadingDialog pd = new RLLoadingDialog(context);
    if (!isQuietly) {
        pd.setMessage(R.string.is_checking_update);
        pd.show();
    }
    UmengUpdateAgent.setUpdateAutoPopup(false);
    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.setOnDownloadListener(null);
    UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
        @Override
        public void onUpdateReturned(int status, UpdateResponse resp) {
            pd.dismiss();
            if (status == 0) {
                UmengUpdateAgent.showUpdateDialog(context, resp);
            } else {
                if (isQuietly) {
                    return;
                }
                if (status == 1) {
                    RLUiUtil.toast(context, R.string.UMNoUpdate);
                } else if (status == 2) {
                    RLUiUtil.toast(context, R.string.UMNoWifi);
                } else if (status == 3) {
                    RLUiUtil.toast(context, R.string.UMTimeout);
                }
            }
        }
    });
    UmengUpdateAgent.update(context);
}
 
Example #19
Source File: MainPresenter.java    From GankDaily with GNU General Public License v3.0 5 votes vote down vote up
public void checkAutoUpdateByUmeng() {
    if(mContext.getIntent().getSerializableExtra("BUNDLE_GANK") == null){
        UmengUpdateAgent.setUpdateCheckConfig(BuildConfig.DEBUG);
        //check update even in 2g/3g/4g condition
        UmengUpdateAgent.setUpdateOnlyWifi(false);
        UmengUpdateAgent.update(mContext);
    }
}
 
Example #20
Source File: ActivitySetting.java    From wakao-app with MIT License 5 votes vote down vote up
private void initView() {
	TextView tView = (TextView) findViewById(R.id.top_bar_title);
	ImageButton iButton = (ImageButton) findViewById(R.id.m_toggle);
	checkUpdate = (TextView) findViewById(R.id.checkUpdate);
	agent = new FeedbackAgent(this);
	agent.sync();

	ac_desc = (TextView) findViewById(R.id.account_settings_desc);
	ac = (TextView) findViewById(R.id.account_name);
	cacheSize = (TextView) findViewById(R.id.cache_size);
	logout = (TextView) findViewById(R.id.logout);

	tView.setText("设置");
	iButton.setVisibility(View.GONE);
	cacheSize.setText(AppTool.getCacheSize(this));
	
	checkUpdate.setOnClickListener(new View.OnClickListener() {
		public void onClick(View v) {
			// 如果想程序启动时自动检查是否需要更新, 把下面两行代码加在Activity 的onCreate()函数里。
			com.umeng.common.Log.LOG = true;
			
			UmengUpdateAgent.setUpdateOnlyWifi(false); // 目前我们默认在Wi-Fi接入情况下才进行自动提醒。如需要在其他网络环境下进行更新自动提醒,则请添加该行代码
			UmengUpdateAgent.setUpdateAutoPopup(false);
			UmengUpdateAgent.setUpdateListener(new MyUpdateListener(mContext));
			UmengUpdateAgent.setDownloadListener(new UpdateDownloadListener(mContext));
			UmengUpdateAgent.forceUpdate(mContext);
		}
	});
}
 
Example #21
Source File: StartActivity.java    From AnimeTaste with MIT License 5 votes vote down vote up
public void rateForUsOrCheckUpdate() {
    if (mSharedPreferences.getInt("playcount", 0) > 10
            && !mSharedPreferences.getBoolean("sharedApp", false)) {
        AlertDialog.Builder builder = new Builder(mContext);
        builder.setMessage(R.string.rate_share_message);
        builder.setTitle(R.string.rate_share_title);
        builder.setPositiveButton(R.string.rate_share_i_do,
                new OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent shareIntent = new Intent(Intent.ACTION_SEND);
                        shareIntent.setType("text/plain");
                        shareIntent.putExtra(
                                android.content.Intent.EXTRA_SUBJECT,
                                getText(R.string.share_title));
                        shareIntent.putExtra(
                                android.content.Intent.EXTRA_TEXT,
                                getText(R.string.share_app_body));
                        startActivity(Intent.createChooser(shareIntent,
                                getText(R.string.share_via)));
                        MobclickAgent.onEvent(mContext, "need_share");
                    }
                });
        builder.setNegativeButton(R.string.rate_share_sorry, null);
        builder.show();
        mSharedPreferences.edit().putBoolean("sharedApp", true).commit();

    } else {
        UmengUpdateAgent.update(this);
    }
}
 
Example #22
Source File: InitAppTask.java    From YiBo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(Void result) {
	super.onPostExecute(result);

	context.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	if (shejiaomao.isAutoScreenOrientation()) {
           context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
	} else {
		context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	context.updateContentView(null);

	if (!NetUtil.isConnect(context)) {
		showNetSettingsDialog();
	}

	if (GlobalVars.IS_MOBILE_NET_UPDATE_VERSION) {
		UmengUpdateAgent.setUpdateOnlyWifi(false);
	}
	if (shejiaomao.isCheckNewVersionOnStartup()) {
		//检查更新
		UmengUpdateAgent.update(context);
	}

	//清除缓存
	StatusesCleanTask statusCleanTask = new StatusesCleanTask(context);
	statusCleanTask.execute();
	ImageCacheQuickCleanTask imageCacheTask = new ImageCacheQuickCleanTask(context);
	imageCacheTask.execute();
}
 
Example #23
Source File: SimplifyReaderApplication.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    MobclickAgent.setDebugMode(true);
    MobclickAgent.updateOnlineConfig(this);
    MobclickAgent.openActivityDurationTrack(false);
    UmengUpdateAgent.update(this);

    VolleyHelper.getInstance().init(this);
    ImageLoader.getInstance().init(ImageLoaderHelper.getInstance(this).getImageLoaderConfiguration(ApiConstants.Paths.IMAGE_LOADER_CACHE_PATH));
}
 
Example #24
Source File: IndexActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	ViewUtils.inject(this);
	App.addActivity(this); // 在界面启动栈中加入该界面
	UmengUpdateAgent.update(this);   //友盟检查更新
	init();
	uploadDingOrCai();
}
 
Example #25
Source File: MainActivity2.java    From wakao-app with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.frame_content);
	setBehindContentView(R.layout.frame_menu);

	configSlidingMenu();
	initUI();

	UmengUpdateAgent.update(this);
	Log.e("TAG", "MainActivity Create");
}
 
Example #26
Source File: MainActivity.java    From phphub-android with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BusProvider.getInstance().register(this);
    setupTabView();

    meIconView = (BGABadgeFrameLayout) viewpagerTab.getTabAt(3).findViewById(R.id.badgeView);
    startService(new Intent(this, NotificationService.class));

    UmengUpdateAgent.update(this);
}
 
Example #27
Source File: UmengUpdateAgentProxy.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
/**
 * 强制更新
 * 
 * @param context
 * @param listener
 */
public static void forceUpdate(Context context, UmengUpdateListener listener)
{
	// 检查更新
	UmengUpdateAgent.forceUpdate(context);
	UmengUpdateAgent.setUpdateListener(listener);
}
 
Example #28
Source File: UmengUpdateAgentProxy.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
/**
 * 自动更新检查
 * 
 * @param context
 */
public static void update(Context context)
{
	UmengUpdateAgent.setDefault();
	UmengUpdateAgent.setDeltaUpdate(true);
	UmengUpdateAgent.update(context);
}
 
Example #29
Source File: MainActivity.java    From ChipHellClient with Apache License 2.0 5 votes vote down vote up
private void umengUpdate(final boolean auto) {
    if (!auto) {
        ToastUtil.show(getApplicationContext(), "正在检查新版本");
    }
    UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
        @Override
        public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
            switch (updateStatus) {
                case UpdateStatus.Yes: // has update
                    startActivity(UpdateActivity.getStartIntent(getApplicationContext(), updateInfo));
                    break;
                case UpdateStatus.No: // has no update
                    if (!auto) {
                        ToastUtil.show(getApplicationContext(), "没有新版本");
                    }
                    break;
                case UpdateStatus.NoneWifi: // none wifi
                    break;
                case UpdateStatus.Timeout: // time out
                    if (!auto) {
                        ToastUtil.show(getApplicationContext(), "网络超时");
                    }
                    break;
            }
        }
    });
    if (auto) {
        UmengUpdateAgent.update(this);
    } else {
        UmengUpdateAgent.forceUpdate(this);
    }
}
 
Example #30
Source File: HomeActivity.java    From Meizi with Apache License 2.0 5 votes vote down vote up
@Override
public void initData() {
    super.initData();
    UmengUpdateAgent.update(this);
    UmengUpdateAgent.setUpdateOnlyWifi(true);
    mPresenter.initAdapterData(adapter);
}