com.umeng.update.UpdateStatus Java Examples

The following examples show how to use com.umeng.update.UpdateStatus. 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: 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 #2
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 #3
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 #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: 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 #6
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 #7
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 #8
Source File: SettingFragment.java    From v2ex-daily-android with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onPreferenceClick(final Preference preference) {
    if(preference.getKey().equals(PREF_CONTACT)){
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        intent.setData(Uri.parse("mailto:[email protected]"));
        if(intent.resolveActivity(getActivity().getPackageManager()) != null)
            startActivity(intent);
        else{
            AppMsg.makeText(getActivity(), "没有找到邮件程序", AppMsg.STYLE_CONFIRM).show();
        }
        return true;
    }else if(preference.getKey().equals(PREF_UPDATE)){
        UmengUpdateAgent.forceUpdate(getActivity());
        UmengUpdateAgent.setUpdateListener(new UmengUpdateListener() {
            @Override
            public void onUpdateReturned(int i, UpdateResponse updateResponse) {
                if(getActivity() != null){
                    switch (i){
                        case UpdateStatus.No:
                            AppMsg.makeText(getActivity(), "您现在使用的就是最新版本", AppMsg.STYLE_INFO).show();
                            break;
                        case UpdateStatus.Timeout:
                            AppMsg.makeText(getActivity(), "网络超时", AppMsg.STYLE_CONFIRM).show();
                            break;
                    }
                }
                UmengUpdateAgent.setUpdateListener(null);
            }
        });
        return true;
    }else if(preference.getKey().equals(PREF_LOGIN)){
        if(logined){
            new AlertDialog.Builder(getActivity())
                    .setCancelable(true)
                    .setMessage("你确定要退出登录吗?")
                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            logout();
                        }
                    }).setNegativeButton("取消", null)
                    .show();
        }else{
            startActivityForResult(new Intent(getActivity(), LoginActivity.class), REQUEST_CODE_LOGIN);
        }
        return true;
    }else if(preference.getKey().equals(PREF_SYNC)){
        final ProgressDialog progressDialog = ProgressDialog.show(getActivity(), null, "Syncing...", true, true);
        V2EX.getUserInfo(getActivity(), new JsonHttpResponseHandler(){
            @Override
            public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                DebugUtils.log(response);
                try{
                    progressDialog.setMessage("Import Node Collections...");
                    JSONArray collectionsJson = response.getJSONObject("content").getJSONArray("collections");
                    String[] collections = new String[collectionsJson.length()];
                    for(int i = 0; i < collections.length; i++){
                        collections[i] = collectionsJson.getString(i);
                    }
                    mAllNodesDataHelper.removeCollections();
                    mAllNodesDataHelper.importCollections(collections);
                    long currentTimeMillis = System.currentTimeMillis();
                    PreferenceManager.getDefaultSharedPreferences(getActivity()).edit()
                            .putLong("sync_time", currentTimeMillis)
                            .commit();
                    progressDialog.setMessage("Finished");
                    progressDialog.dismiss();
                    preference.setSummary(TextUtils.getRelativeTimeDisplayString(getActivity(), currentTimeMillis));
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
        return true;
    }else {
        return false;
    }
}