Java Code Examples for com.umeng.update.UmengUpdateAgent#update()

The following examples show how to use com.umeng.update.UmengUpdateAgent#update() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
Source File: MainActivity.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
private void init() {
	MainActivityActionbar = getSupportActionBar();
	mFragmentManager = getSupportFragmentManager();
	setDrawer();
	initWeekTitle();
	agent = new FeedbackAgent(this);
	agent.sync();
	// MobclickAgent.setDebugMode(true);
	MobclickAgent.openActivityDurationTrack(false);
	UmengUpdateAgent.setUpdateOnlyWifi(false);
	UmengUpdateAgent.update(this);
}
 
Example 10
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);
}
 
Example 11
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 12
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 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: MainActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	UmengUpdateAgent.update(this);

	currentPageLatest = 0;
	currentPageRecommended = 0;
	currentPage = 0;
	isFromRefreshData = true;
	isFromRefreshDataRecommended = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();

	setContentView(R.layout.activity_main);

	pager = (ViewPager) findViewById(R.id.main_pager);
	pager.setOffscreenPageLimit(2);

	fragments = new ArrayList<Fragment>();
	menuImageView = (ImageView) findViewById(R.id.main_menu_imageView);
	menuImageView.setOnClickListener(this);// 菜单点击
	searchImageView = (ImageView) findViewById(R.id.main_search_imageview);
	searchImageView.setOnClickListener(this);// 搜索点击

	recommendedButton = (RadioButton) findViewById(R.id.main_recommended_radio);
	recommendedButton.setOnClickListener(this);
	latestButton = (RadioButton) findViewById(R.id.main_latest_radio);
	latestButton.setOnClickListener(this);
	categoryButton = (RadioButton) findViewById(R.id.main_category_radio);
	categoryButton.setOnClickListener(this);

	LatestFragment latestFragment = new LatestFragment();
	RecommendedFragment recommendedFragment = new RecommendedFragment();
	CategoryFragment categoryFragment = new CategoryFragment();
	categoryFragment.setCategoryFragmentListener(this);

	fragments.add(latestFragment);
	fragments.add(recommendedFragment);
	fragments.add(categoryFragment);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	pager.setOnPageChangeListener(this);

	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);

	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);

}
 
Example 15
Source File: LoginActivity.java    From Studio with Apache License 2.0 4 votes vote down vote up
private void setupUmengUpdate() {
    UmengUpdateAgent.update(this);
    UmengUpdateAgent.setDeltaUpdate(false);
    UmengUpdateAgent.setUpdateOnlyWifi(false);
}
 
Example 16
Source File: MainActivity.java    From gank with GNU General Public License v3.0 4 votes vote down vote up
private void setupUmeng() {
    UmengUpdateAgent.update(this);
    UmengUpdateAgent.setDeltaUpdate(false);
    UmengUpdateAgent.setUpdateOnlyWifi(false);
}
 
Example 17
Source File: AppUpgrade.java    From bleYan with GNU General Public License v2.0 4 votes vote down vote up
public static void update(Context context) {
    UmengUpdateAgent.setUpdateOnlyWifi(true);
    UmengUpdateAgent.update(context);
}
 
Example 18
Source File: MainActivity.java    From ONE-Unofficial with Apache License 2.0 4 votes vote down vote up
private void setUmeng() {
        //对友盟统计日志加密
        AnalyticsConfig.enableEncrypt(true);
        //友盟统计不采集mac信息
        MobclickAgent.setCheckDevice(false);

        //禁止自动提示更新对话框
        UmengUpdateAgent.setUpdateAutoPopup(false);
        //禁止增量更新
        UmengUpdateAgent.setDeltaUpdate(false);
        UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
            @Override
            public void onUpdateReturned(int status, UpdateResponse updateResponse) {
                switch (status) {
                    case UpdateStatus.Yes:
                        //有更新
                        showUpdateDialog(updateResponse);
                        break;
                    case UpdateStatus.No:
                        //无更新
                        break;
                    case UpdateStatus.NoneWifi:
                        //无wifi
                        break;
                    case UpdateStatus.Timeout:
                        //超时
                        break;
                }
            }
        });
        //友盟设置检查更新,不限于wifi
        UmengUpdateAgent.setUpdateOnlyWifi(false);
        //禁用集成检测,否则会提示缺少xxx,然而我并不需要那些东西
        UmengUpdateAgent.setUpdateCheckConfig(false);
        //检查更新
        UmengUpdateAgent.update(this);

        //同步数据
        final FeedbackAgent agent = new FeedbackAgent(this);
//        agent.openFeedbackPush();      启用推送在小米手机上会有崩溃发生
        agent.sync();
        UserInfo userInfo = agent.getUserInfo();
        String nickname = ConfigUtil.readString("user", "nickname");
        if (TextUtils.isEmpty(nickname)) {
            final String n = generateNickname();
            Map<String, String> contact = new HashMap<>();
            contact.put("昵称", n);
            userInfo.setContact(contact);
            agent.setUserInfo(userInfo);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    boolean success = agent.updateUserInfo();
                    if (success) {
                        ConfigUtil.writeString("user", "nickname", n);
                    }
                }
            }).start();

        }
        //启用推送
//        PushAgent.getInstance(this).enable();  启用推送在小米手机上会有崩溃发生
    }
 
Example 19
Source File: MainActivity.java    From AppPlus with MIT License 4 votes vote down vote up
private void checkAutoUpdateByUmeng() {
    UmengUpdateAgent.update(this);
}
 
Example 20
Source File: MainActivity.java    From wallpaper with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	UmengUpdateAgent.update(this);

	currentPageLatest = 0;
	currentPageRecommended = 0;
	currentPage = 0;
	isFromRefreshData = true;
	isFromRefreshDataRecommended = true;
	latestGroups = new ArrayList<Group>();
	recommendedGroups = new ArrayList<Group>();

	setContentView(R.layout.activity_main);

	pager = (ViewPager) findViewById(R.id.main_pager);
	pager.setOffscreenPageLimit(2);

	fragments = new ArrayList<Fragment>();
	menuImageView = (ImageView) findViewById(R.id.main_menu_imageView);
	menuImageView.setOnClickListener(this);// 菜单点击
	searchImageView = (ImageView) findViewById(R.id.main_search_imageview);
	searchImageView.setOnClickListener(this);// 搜索点击

	recommendedButton = (RadioButton) findViewById(R.id.main_recommended_radio);
	recommendedButton.setOnClickListener(this);
	latestButton = (RadioButton) findViewById(R.id.main_latest_radio);
	latestButton.setOnClickListener(this);
	categoryButton = (RadioButton) findViewById(R.id.main_category_radio);
	categoryButton.setOnClickListener(this);

	LatestFragment latestFragment = new LatestFragment();
	RecommendedFragment recommendedFragment = new RecommendedFragment();
	CategoryFragment categoryFragment = new CategoryFragment();
	categoryFragment.setCategoryFragmentListener(this);

	fragments.add(latestFragment);
	fragments.add(recommendedFragment);
	fragments.add(categoryFragment);

	mAdapter = new ViewPagerAdapter(getSupportFragmentManager(), fragments);
	pager.setAdapter(mAdapter);
	pager.setOnPageChangeListener(this);

	menu = new SlidingMenu(this);
	menu.setMode(SlidingMenu.LEFT);
	menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
	menu.setShadowWidthRes(R.dimen.shadow_width);

	menu.setShadowDrawable(R.drawable.slidingmenu_shadow);
	menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	menu.setFadeDegree(0.35f);
	menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
	menu.setMenu(R.layout.layout_menu);
	menu.setMode(SlidingMenu.LEFT);
	menu.setMenu(R.layout.layout_menu);
	long screenWidth = WallWrapperEnvConfigure.getScreenWidth();
	menu.setBehindWidth((int) (screenWidth * 0.7));

	menuListView = (ListView) menu.getMenu().findViewById(R.id.menu_listview);
	menuListView.setAdapter(new MenuListViewAdapter(this));
	menuListView.setOnItemClickListener(this);

}