本文整理汇总了Java中cn.bmob.v3.update.BmobUpdateAgent.setUpdateListener方法的典型用法代码示例。如果您正苦于以下问题:Java BmobUpdateAgent.setUpdateListener方法的具体用法?Java BmobUpdateAgent.setUpdateListener怎么用?Java BmobUpdateAgent.setUpdateListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.bmob.v3.update.BmobUpdateAgent
的用法示例。
在下文中一共展示了BmobUpdateAgent.setUpdateListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import cn.bmob.v3.update.BmobUpdateAgent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_travelban);
BmobUpdateAgent.initAppVersion(this);
ActivityCollector.addActivity(this);
BmobUpdateAgent.update(this);
BmobUpdateAgent.setUpdateListener(new BmobUpdateListener() {
@Override
public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
}
});
setData();
User userInfo = BmobUser.getCurrentUser(TravelBanActivity.this, User.class);
if (userInfo.getAccount()!=null) {
userName=userInfo.getAccount();
}
mImageProvider = new ImageProvider(this);
initView();
Toast.makeText(TravelBanActivity.this, "欢迎," + userName + "!", Toast.LENGTH_SHORT).show();
}
示例2: update
import cn.bmob.v3.update.BmobUpdateAgent; //导入方法依赖的package包/类
/**
* 这个是进行app的版本的升级
*/
private void update() {
//BmobUpdateAgent.setUpdateOnlyWifi(true);
BmobUpdateAgent.setUpdateListener(new BmobUpdateListener() {
@Override
public void onUpdateReturned(int updateStatus, UpdateResponse updateInfo) {
// TODO Auto-generated method stub
if (updateStatus == UpdateStatus.Yes) {//版本有更新
} else if (updateStatus == UpdateStatus.No) {
//Toast.makeText(MainActivity.this, "版本无更新", Toast.LENGTH_SHORT).show();
} else if (updateStatus == UpdateStatus.EmptyField) {//此提示只是提醒开发者关注那些必填项,测试成功后,无需对用户提示
//Toast.makeText(MainActivity.this, "请检查你AppVersion表的必填项,1、target_size(文件大小)是否填写;2、path或者android_url两者必填其中一项。", Toast.LENGTH_SHORT).show();
} else if (updateStatus == UpdateStatus.IGNORED) {
//Toast.makeText(MainActivity.this, "该版本已被忽略更新", Toast.LENGTH_SHORT).show();
} else if (updateStatus == UpdateStatus.ErrorSizeFormat) {
//Toast.makeText(MainActivity.this, "请检查target_size填写的格式,请使用file.length()方法获取apk大小。", Toast.LENGTH_SHORT).show();
} else if (updateStatus == UpdateStatus.TimeOut) {
Toast.makeText(MainActivity.this, "查询出错或查询超时", Toast.LENGTH_SHORT).show();
}
}
});
//发起自动更新
BmobUpdateAgent.update(this);
//设置对对话框按钮的点击事件的监听
BmobUpdateAgent.setDialogListener(new BmobDialogButtonListener() {
@Override
public void onClick(int status) {
// TODO Auto-generated method stub
switch (status) {
case UpdateStatus.Update:
Toast.makeText(MainActivity.this, "立即更新", Toast.LENGTH_SHORT).show();
break;
case UpdateStatus.NotNow:
Toast.makeText(MainActivity.this, "以后再说", Toast.LENGTH_SHORT).show();
break;
case UpdateStatus.Close:
//只有在强制更新状态下才会在更新对话框的右上方出现close按钮,
// 如果用户不点击”立即更新“按钮,这时候开发者可做些操作,比如直接退出应用等
Toast.makeText(MainActivity.this, "对话框关闭按钮", Toast.LENGTH_SHORT).show();
break;
}
}
});
}
示例3: fillDatas
import cn.bmob.v3.update.BmobUpdateAgent; //导入方法依赖的package包/类
private void fillDatas() {
AppUser appUser = BmobUser.getCurrentUser(AppUser.class);
if (appUser == null) {
meNickNameTv.setText("未登录, 请点击登录");
meMessageTv.setText("这位童鞋很懒, 什么都没留下...");
meAvatarImv.setImageResource(R.drawable.app_icon);
} else {
meNickNameTv.setText(appUser.getUserNickName());
if ("".equals(appUser.getUserMessage()) || null == appUser.getUserMessage()) {
meMessageTv.setText("这位童鞋很懒, 什么都没留下...");
} else {
meMessageTv.setText(appUser.getUserMessage());
}
Log.i(LOG, "appUser.getUserAvatarUrl() = " + appUser.getUserAvatarUrl());
if ("".equals(appUser.getUserAvatarUrl()) || null == appUser.getUserAvatarUrl()) {
meAvatarImv.setImageResource(R.drawable.app_icon);
} else {
Glide.with(FourthFragment.this)
.load(appUser.getUserAvatarUrl())
.error(R.drawable.app_icon)
.centerCrop()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(meAvatarImv);
}
}
// 自动更新检测
BmobUpdateAgent.setUpdateListener(new BmobUpdateListener() {
@Override
public void onUpdateReturned(int updateStatus, UpdateResponse updateResponse) {
switch (updateStatus) {
case UpdateStatus.Yes:
Log.i("LOG", "YYYYYYYY");
break;
case UpdateStatus.No:
Log.i("LOG", "NNNNNNNNN");
Toast.makeText(getActivity(), "已是最新版本", Toast.LENGTH_SHORT).show();
break;
case UpdateStatus.TimeOut:
Log.i("LOG", "TTTTTTTTT");
Toast.makeText(getActivity(), "连接超时,请稍后再试",
Toast.LENGTH_SHORT).show();
break;
default:
Log.i("LOG", "FFFFFFFFF");
Toast.makeText(getActivity(), "连接超时,请稍后再试",
Toast.LENGTH_SHORT).show();
break;
}
}
});
}