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

The following examples show how to use com.umeng.update.UmengUpdateAgent#setUpdateOnlyWifi() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
Source File: CameraListActivity.java    From Viewer with Apache License 2.0 4 votes vote down vote up
@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.camera_list);
		mUserInfo = UserInfo.getUserInfo(this);
		mLayoutInflater = LayoutInflater.from(this);
		mUserLayout = (DrawerLayout) findViewById(R.id.user_layout);
		mCameraListView = (PullToRefreshListView) findViewById(R.id.cameraList);
		mCameraListView.setOnRefreshListener(this);
		
		findViewById(R.id.help).setOnClickListener(this);
		findViewById(R.id.feedback).setOnClickListener(this);
		findViewById(R.id.about).setOnClickListener(this);
		findViewById(R.id.disclaimer).setOnClickListener(this);
		findViewById(R.id.business).setOnClickListener(this);
		Button logout = (Button) findViewById(R.id.logout);
		logout.setOnClickListener(this);
		if(!mUserInfo.isLogin) logout.setVisibility(View.INVISIBLE);
		
		TextView userNameView = (TextView) findViewById(R.id.user_name);
		String name = getResources().getString(R.string.not_login);
		userNameView.setText(StringUtils.isEmpty(mUserInfo.name) ? name : mUserInfo.name);
//		mToolbar = (Toolbar) findViewById(R.id.toolbar);
//		mToolbar.setTitle(R.string.app_name);
//		setSupportActionBar(mToolbar);
//		mToolbar.setOnMenuItemClickListener(this);
//		mToolbar.setNavigationIcon(R.drawable.navigation_icon);
//		mToolbar.setNavigationOnClickListener(new OnClickListener() {
//			
//			@Override
//			public void onClick(View v) {
//				if(!mUserLayout.isDrawerOpen(Gravity.LEFT))
//					mUserLayout.openDrawer(Gravity.LEFT);
//			}
//		});
		
		mViewer = Viewer.getViewer();
		mMyViewerHelper = MyViewerHelper.getInstance(getApplicationContext());
		mMyViewerHelper.addCameraStateListener(this);
		mCameraDefaulThumb = BitmapFactory.decodeResource(getResources(), R.drawable.avs_type_android);
		
		mCameraInfoManager = new CameraInfoManager(this);
		mCameraInfos = mMyViewerHelper.getAllCameraInfos();
		for (CameraInfo info : mCameraInfos) {
			addStreamer(info.getCid(), info.getCameraUser(), info.getCameraPwd());
		}
		mCameraListAdapter = new CameraListAdapter(this, mCameraInfos);
		mCameraListView.setAdapter(mCameraListAdapter);
		mCameraListView.setOnItemClickListener(this);
//        mCameraListView.setOnScrollChangeListener(new OnScrollChangeListener() {
//            
//            @Override
//            public void onScrollChange(View v, int scrollX, int scrollY,
//                    int oldScrollX, int oldScrollY) {
//                mCameraListAdapter.closeAllItems();
//            }
//        });

		mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());
		
		mCameraListHandler = new CameraListHandler(this, mHandler);
		mCameraListHandler.doThing(CameraListHandler.SYNC_CID_REQUEST);
		mAddCidHandler = new AddCidHandler(this, mHandler);
		mEditCidHandler = new EditCidHandler(this, mHandler);
		
		//update
		UmengUpdateAgent.setUpdateOnlyWifi(false);
		UmengUpdateAgent.update(this);
		findViewById(R.id.back_linlayout).setOnClickListener(this);
		findViewById(R.id.titlebar_back_image).setBackgroundResource(R.drawable.navigation_icon);
		titlebar_back_text = (TextView) findViewById(R.id.titlebar_back_text);
		titlebar_back_text.setText(R.string.app_name);
		titlebar_opt_image = (ImageView) findViewById(R.id.titlebar_opt_image);
		titlebar_opt_image.setBackgroundResource(R.drawable.add_icon);//(getResources().getDrawable(R.drawable.add_icon));
		findViewById(R.id.opt_linlayout).setOnClickListener(this);
		add_layout = (LinearLayout) findViewById(R.id.add_layout);
//		findViewById(R.id.add_cid).setOnClickListener(this);
//		findViewById(R.id.add_cid_by_qr).setOnClickListener(this);
	}
 
Example 8
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 9
Source File: AvsActivity.java    From AVS with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_main);
	if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    	getWindow().setStatusBarColor(getResources().getColor(R.color.background));
    }
	mLayoutInflater = LayoutInflater.from(this);
	TextView cidView = (TextView) findViewById(R.id.cid);
	cidView.setOnClickListener(this);
	TextView pwdView = (TextView) findViewById(R.id.pwd);
	pwdView.setOnClickListener(this);
	TextView statusView = (TextView) findViewById(R.id.logState);
	TextView deviceName = (TextView) findViewById(R.id.deviceName);
	ImageView barCodeView = (ImageView) findViewById(R.id.barcode);
	ImageView menuView = (ImageView) findViewById(R.id.menu);
	menuView.setOnClickListener(this);
    menu_layout = (LinearLayout) findViewById(R.id.menu_layout);
    menu_layout.setOnClickListener(this);
    findViewById(R.id.main_layout).setOnClickListener(this);
    findViewById(R.id.help).setOnClickListener(this);
    findViewById(R.id.feedback).setOnClickListener(this);
    findViewById(R.id.about).setOnClickListener(this);
    findViewById(R.id.disclaimer).setOnClickListener(this);
    findViewById(R.id.avs_title).setOnClickListener(this);
    mMyAvsHelper = new MyAvsHelper(getApplicationContext());
    mMyAvsHelper.setViews(cidView, pwdView, statusView, deviceName, barCodeView);
    mMyAvsHelper.login();
	final int[] size = mMyAvsHelper.getVideoSize();
	
	mMediaSurfaceView = (MediaSurfaceView) findViewById(R.id.cameraView);
	mMediaSurfaceView.openCamera(mMyAvsHelper);
	
	ViewTreeObserver viewTreeObserver = mMediaSurfaceView.getViewTreeObserver();
	viewTreeObserver.addOnPreDrawListener(new OnPreDrawListener(){
		@Override
		public boolean onPreDraw(){
			if (isFirst){
				int height = mMediaSurfaceView.getMeasuredHeight();
				int width = mMediaSurfaceView.getMeasuredWidth();
				float r = (float)height/(float)width;
				float r2 = (float)size[1]/(float)size[0];
				RelativeLayout.LayoutParams pvLayout = (RelativeLayout.LayoutParams) mMediaSurfaceView.getLayoutParams();
				if (r > r2){
					pvLayout.height = (int) (width*r2);
				}else{
					pvLayout.width = (int) (height/r2);
				}
				isFirst = false;
			}
			return true;
		}
	});		
	
	mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());
	//update
	UmengUpdateAgent.setUpdateOnlyWifi(false);
	UmengUpdateAgent.update(this);
	
}
 
Example 10
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 11
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 12
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 13
Source File: AvsActivity.java    From AVS with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_main);
	if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    	getWindow().setStatusBarColor(getResources().getColor(R.color.background));
    }
	mLayoutInflater = LayoutInflater.from(this);
	TextView cidView = (TextView) findViewById(R.id.cid);
	cidView.setOnClickListener(this);
	TextView pwdView = (TextView) findViewById(R.id.pwd);
	pwdView.setOnClickListener(this);
	TextView statusView = (TextView) findViewById(R.id.logState);
	TextView deviceName = (TextView) findViewById(R.id.deviceName);
	ImageView barCodeView = (ImageView) findViewById(R.id.barcode);
	ImageView menuView = (ImageView) findViewById(R.id.menu);
	menuView.setOnClickListener(this);
    menu_layout = (LinearLayout) findViewById(R.id.menu_layout);
    menu_layout.setOnClickListener(this);
    findViewById(R.id.main_layout).setOnClickListener(this);
    findViewById(R.id.help).setOnClickListener(this);
    findViewById(R.id.feedback).setOnClickListener(this);
    findViewById(R.id.about).setOnClickListener(this);
    findViewById(R.id.disclaimer).setOnClickListener(this);
    findViewById(R.id.avs_title).setOnClickListener(this);
    mMyAvsHelper = new MyAvsHelper(getApplicationContext());
    mMyAvsHelper.setViews(cidView, pwdView, statusView, deviceName, barCodeView);
    mMyAvsHelper.login();
	final int[] size = mMyAvsHelper.getVideoSize();
	
	mMediaSurfaceView = (MediaSurfaceView) findViewById(R.id.cameraView);
	mMediaSurfaceView.openCamera(mMyAvsHelper);
	
	ViewTreeObserver viewTreeObserver = mMediaSurfaceView.getViewTreeObserver();
	viewTreeObserver.addOnPreDrawListener(new OnPreDrawListener(){
		@Override
		public boolean onPreDraw(){
			if (isFirst){
				int height = mMediaSurfaceView.getMeasuredHeight();
				int width = mMediaSurfaceView.getMeasuredWidth();
				float r = (float)height/(float)width;
				float r2 = (float)size[1]/(float)size[0];
				RelativeLayout.LayoutParams pvLayout = (RelativeLayout.LayoutParams) mMediaSurfaceView.getLayoutParams();
				if (r > r2){
					pvLayout.height = (int) (width*r2);
				}else{
					pvLayout.width = (int) (height/r2);
				}
				isFirst = false;
			}
			return true;
		}
	});		
	
	mShowChinese = "zh".equals(Locale.getDefault().getLanguage().toLowerCase());
	//update
	UmengUpdateAgent.setUpdateOnlyWifi(false);
	UmengUpdateAgent.update(this);
	
}
 
Example 14
Source File: Main.java    From iSCAU-Android with GNU General Public License v3.0 4 votes vote down vote up
private void checkForUpdate() {
    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.update(this);
}
 
Example 15
Source File: ChhApplication.java    From ChipHellClient with Apache License 2.0 4 votes vote down vote up
private void setupUpdate() {
    UmengUpdateAgent.setUpdateAutoPopup(false);
    UmengUpdateAgent.setUpdateOnlyWifi(false);
}