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

The following examples show how to use com.umeng.update.UmengUpdateAgent#forceUpdate() . 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: 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 2
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 3
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 4
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 5
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 6
Source File: HomeActivity.java    From Moring-Alarm with Apache License 2.0 4 votes vote down vote up
public void checkUpdate(View v){
    mFragSlideMenu.stopAlarmMusic();
    UmengUpdateAgent.forceUpdate(this);
}
 
Example 7
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 4 votes vote down vote up
/**
 * 检查版本更新
 * @param view
 */
@OnClick(R.id.update_layout)
private void checkUpdate(View view) {
	UmengUpdateAgent.forceUpdate(this);
}
 
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;
    }
}