当前位置: 首页>>代码示例>>Java>>正文


Java BmobInstallation类代码示例

本文整理汇总了Java中cn.bmob.v3.BmobInstallation的典型用法代码示例。如果您正苦于以下问题:Java BmobInstallation类的具体用法?Java BmobInstallation怎么用?Java BmobInstallation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BmobInstallation类属于cn.bmob.v3包,在下文中一共展示了BmobInstallation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doSign

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
private void doSign(String mail, String pass, String nick){
    final BBUser bbUser=new BBUser();
    if(mAvatar.equals("")){
        String avatar=ConsUtils.getDefaultAvatar();
        bbUser.setAvatar(avatar);
        bbUser.setAvatarUrl(avatar);
    }else{
        bbUser.setAvatar(AvatarUrl);
        bbUser.setAvatarUrl(AvatarUrl);
    }
    //邮箱地址作为用户名
    bbUser.setUsername(mail);
    bbUser.setPassword(pass);
    bbUser.setEmail(mail);
    bbUser.setNick(nick);
    bbUser.setAvatarName(AvatarName);
    bbUser.setDeviceType("android");
    bbUser.setInstallId(BmobInstallation.getInstallationId(this));
    turnUI(true, bbUser);
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:21,代码来源:SignActivity.java

示例2: sendReply

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
private void sendReply(String installId) {
    String installationId =installId;
    BmobPushManager bmobPush = new BmobPushManager(CommentActivity.this);
    BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
    query.addWhereEqualTo("installationId", installationId);
    bmobPush.setQuery(query);
    PushMessage pm=new PushMessage(comment.getObjectId(),1);
    JSONObject jsonObject=new JSONObject();
    try {
        jsonObject.put("alert",pm.alert);
        jsonObject.put("tag",pm.tag);
        jsonObject.put("type",pm.type);
        bmobPush.pushMessage(jsonObject);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:18,代码来源:CommentActivity.java

示例3: initData

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
private void initData() {
    initReceiver();
    initUnread();
    mUser = BBUser.getCurrentUser(this, BBUser.class);
    //设置用户名和头像
    showAvatarAndNick();
    //用户换设备登陆后一样可以接收到信息
    BmobInstallation installation=new BmobInstallation(this);
    if(mUser.getInstallId()!=installation.getInstallationId()){
        mUser.setInstallId(installation.getInstallationId());
        mUser.update(this, mUser.getObjectId(), new UpdateListener() {
            @Override
            public void onSuccess() {

            }

            @Override
            public void onFailure(int i, String s) {

            }
        });
    }

}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:25,代码来源:HomeActivity.java

示例4: onCreate

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	 // 初始化 Bmob SDK
       // 使用时请将第二个参数Application ID替换成你在Bmob服务器端创建的Application ID
	Bmob.initialize(this, Constants.BmobAPPID);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	//获取当前屏幕宽高
	DisplayMetrics metric = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(metric);
	mScreenWidth = metric.widthPixels;
	mScreenHeight = metric.heightPixels;
	
	// 初始化数据
	mContext = this;
	mBmobInstallation = BmobInstallation.getCurrentInstallation(this);
	mInstallationId = BmobInstallation.getInstallationId(this);
	mCurrentUser = BmobUser.getCurrentUser(this, User.class);

	setContentView();
	initViews();
	initListeners();
	initData();
}
 
开发者ID:vell001,项目名称:VSigner,代码行数:26,代码来源:BaseActivity.java

示例5: sendMessage

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
/**
    * 发送反馈信息给开发者
    * @param message 反馈信息
    */
   private void sendMessage(String message)
   {
BmobPushManager bmobPush = new BmobPushManager(this);
BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
query.addWhereEqualTo("isDeveloper", true);
bmobPush.setQuery(query);
bmobPush.pushMessage(message);

saveFeedbackMsg(message);
   }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:15,代码来源:SkinEngine.java

示例6: push

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@OnClick(R.id.btn_push)
    public void push() {
//        BmobPushManager bmobPushManager = new BmobPushManager();
//        bmobPushManager.pushMessageAll("HowieTian", new PushListener() {
//            @Override
//            public void done(BmobException e) {
//                if (e==null){
//                    showToast("推送成功!");
//                }else {
//                    showToast("异常:" + e.getMessage());
//                }
//            }
//        });
        String installationId = BmobInstallation.getInstallationId(this);
        BmobPushManager bmobPushManager = new BmobPushManager();
        BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
        query.addWhereEqualTo("installationId", installationId);
        bmobPushManager.setQuery(query);
        bmobPushManager.pushMessage("推送检测成功!", new PushListener() {
            @Override
            public void done(BmobException e) {
                if (e == null) {
                   showToast("推送成功!");
                } else {
                   showToast("异常:" + e.getMessage());
                }
            }
        });


    }
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:32,代码来源:Main2Activity.java

示例7: onCreate

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Bmob.initialize(this,Constant.BMOB_KEY);
    // 使用推送服务时的初始化操作
    BmobInstallation.getCurrentInstallation().save();
    // 启动推送服务
    BmobPush.startWork(this);
    NineGridView.setImageLoader(new GlideImageLoader());
}
 
开发者ID:HowieTianDev,项目名称:ChenYan,代码行数:11,代码来源:MyApp.java

示例8: onCreate

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    /**
     * 初始化日志工具
     */
    Logger.addLogAdapter(new AndroidLogAdapter());
    //TODO 集成:1.4、初始化数据服务SDK、保存设备信息并启动推送服务
    /**
     * 初始化比目数据SDK
     */
    Bmob.initialize(this, "e9b559bd68461777602a46dead1b581b");
    /**
     * 保存设备信息,用于推送功能
     */
    BmobInstallationManager.getInstance().initialize(new InstallationListener<BmobInstallation>() {
        @Override
        public void done(BmobInstallation bmobInstallation, BmobException e) {
            if (e == null) {
                Logger.i(bmobInstallation.getObjectId() + "-" + bmobInstallation.getInstallationId());
            } else {
                Logger.e(e.getMessage());
            }
        }
    });
    /**
     * 启动推送服务
     */
    BmobPush.startWork(this);
}
 
开发者ID:chaozhouzhang,项目名称:bmob-push-demo,代码行数:31,代码来源:App.java

示例9: initBmob

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
private void initBmob() {
    BmobChat.DEBUG_MODE = true;
    //BmobIM SDK初始化--只需要这一段代码即可完成初始化
    BmobChat.getInstance(this).init(ConsUtils.APPLICATION_ID);
    // 使用推送服务时的初始化操作
    BmobInstallation.getCurrentInstallation(this).save();
    // 启动推送服务
    BmobChat.DEBUG_MODE = true;
    //BmobIM SDK初始化--只需要这一段代码即可完成初始化
    BmobChat.getInstance(this).init(ConsUtils.APPLICATION_ID);
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:12,代码来源:BBApplication.java

示例10: pushCommit

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
private void pushCommit(List<String> receivers) {
    BmobPushManager bmobPush = new BmobPushManager(CommentActivity.this);
    BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
    query.addWhereContainedIn("installationId",receivers);
    bmobPush.setQuery(query);
    bmobPush.pushMessage(comment.getObjectId());
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:8,代码来源:CommentActivity.java

示例11: onCreate

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bmob.initialize(this, "980918913b223ca35f0c0f69e8850680");
    BmobInstallation.getCurrentInstallation(this).save();
    BmobPush.startWork(this, "980918913b223ca35f0c0f69e8850680");
    BmobUpdateAgent.initAppVersion(this);
    BmobUpdateAgent.setUpdateOnlyWifi(false);
    BmobUpdateAgent.update(this);
}
 
开发者ID:changchengfeng,项目名称:Cloud-Wearher,代码行数:11,代码来源:MainActivity.java

示例12: signUp

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
public void signUp(String userName, String password) {
    User user = new User();
    user.setUsername(userName);
    user.setPassword(password);
    user.setSignature("这个家伙很懒,什么也不说。。。");
    user.setDeviceType("android");
    user.setNick(userName);
    user.setOfficial(false);
    user.setInstallId(BmobInstallation.getInstallationId(mContext));
    user.signUp(mContext, new SaveListener() {
        @Override
        public void onSuccess() {
            progress.dismiss();
            ShowToast("注册成功");
            mUserManager.bindInstallationForRegister(et_username.getText().toString());
            updateUserLocation();
            sendBroadcast(new Intent(Constant.ACTION_REGISTER_SUCCESS_FINISH));
            Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
        }

        @Override
        public void onFailure(int arg0, String msg) {
            ShowToast(R.string.network_tips);
            progress.dismiss();
        }
    });
}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:30,代码来源:RegisterActivity.java

示例13: onClick

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
  public void onClick(View v)
  {
      switch (v.getId())
{
          case R.id.id_send_msg:
              final String mess=mInputMsg.getText().toString();
              if (mess.equals(""))
		{
			//  Toast.makeText(ChatActivity.this, "发送消息不能为空", Toast.LENGTH_SHORT).show();
              }
		else
		{
			Intent intent=getIntent();
                  String nickname=intent.getStringExtra("#");
                  String roomId="校园情色";
                  //上传消息
                  Content content = new Content();
                  content.setRoom_id(roomId);
                  content.setNickname(nickname);
                  content.setContent(mess);
                  content.save(ChatActivity.this, new SaveListener() {

					@Override
					public void onSuccess()
					{
						BmobQuery<BmobInstallation> query = BmobInstallation.getQuery();
						query.addWhereEqualTo("deviceType", "android");
						bmobPush.setQuery(query);
						bmobPush.pushMessage(mess);
						mInputMsg.setText("");
						mSendMsg.setEnabled(false);
						//滚动到底部
						new Handler().postDelayed(new Runnable() {
								@Override
								public void run()
								{
									mSendMsg.setEnabled(true);
									// webview.loadUrl("file:///android_asset/classes8.html");
									//   mMsgs.smoothScrollToPosition(mMsgs.getCount() - 1);//移动到尾部
									mMsgs.setSelection(mMsgs.getBottom());

								}
							}, 3000);
						//Toast.makeText(ChatActivity.this, "发送成功", Toast.LENGTH_SHORT).show();
					}

					@Override
					public void onFailure(int code, String arg0)
					{
						// TODO Auto-generated method stub
						// 添加失败
					}
				});
              }

              break;
      }
  }
 
开发者ID:stytooldex,项目名称:stynico,代码行数:60,代码来源:ChatActivity.java

示例14: initView

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
@Override
        public void initView() {
                name = (AutoEditText) findViewById(R.id.aet_register_name);
                passWord = (AutoEditText) findViewById(R.id.aet_register_password);
                passWordComfirm = (AutoEditText) findViewById(R.id.aet_register_password_confirm);
                register = (Button) findViewById(R.id.btn_register_confirm);
                bg = (ImageView) findViewById(R.id.iv_register_bg);
                register.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                                if (TextUtils.isEmpty(name.getText().toString().trim())) {
                                        ToastUtils.showShortToast(getString(R.string.account_null));
                                        name.startShakeAnimation();
                                        return;
                                }
                                if (TextUtils.isEmpty(passWord.getText())) {
                                        ToastUtils.showShortToast(getString(R.string.password_null));
                                        return;
                                }
                                if (TextUtils.isEmpty(passWordComfirm.getText())) {
                                        ToastUtils.showShortToast(getString(R.string.password_null));
                                        passWordComfirm.startShakeAnimation();
                                        return;
                                }
                                if (!passWord.getText().toString().trim().equals(passWordComfirm.getText().toString().trim())) {
                                        ToastUtils.showShortToast(getString(R.string.register_password_error));
                                        return;
                                }
                                if (!CommonUtils.isNetWorkAvailable(RegisterActivity.this)) {
                                        ToastUtils.showShortToast(getString(R.string.network_tip));
                                        return;
                                }
                                showLoadDialog("正在注册,请稍候.......");
                                User user = new User();
//                                默认注册为男性
                                user.setSex(true);
//                                 设备类型
                                user.setDeviceType("android");
//                                与设备ID绑定
                                user.setInstallId(BmobInstallation.getInstallationId(RegisterActivity.this));
                                user.setNick(RandomData.getRandomNick());
                                user.setAvatar(RandomData.getRandomAvatar());
                                LogUtil.e("用户的头像信息:" + user.getAvatar());
                                user.setSortedKey(CommonUtils.getSortedKey(user.getNick()));
                                user.setUsername(name.getText().toString().trim());
                                user.setPassword(passWord.getText().toString().trim());
                                user.setTitleWallPaper(RandomData.getRandomTitleWallPaper());
                                user.setWallPaper(RandomData.getRandomWallPaper());
                                user.signUp(CustomApplication.getInstance(), new SaveListener() {
                                        @Override
                                        public void onSuccess() {
                                                dismissLoadDialog();
                                                ToastUtils.showShortToast("注册成功");
//                                                        进行用户Id和设备的绑定
                                                if (UserManager.getInstance().getCurrentUser() != null) {
                                                        LogUtil.e("uid:" + UserManager.getInstance().getCurrentUser().getObjectId());
                                                }
                                                Intent intent = new Intent();
                                                intent.putExtra("username", name.getText().toString().trim());
                                                intent.putExtra("password", passWord.getText().toString().trim());
                                                setResult(Activity.RESULT_OK, intent);
                                                finish();
                                        }

                                        @Override
                                        public void onFailure(int i, String s) {
                                                dismissLoadDialog();
                                                ToastUtils.showShortToast("注册失败" + s + i);
                                        }
                                });
                        }
                });
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:74,代码来源:RegisterActivity.java

示例15: AvatarUtils

import cn.bmob.v3.BmobInstallation; //导入依赖的package包/类
public AvatarUtils(Activity activity) {
    this.mActivity =activity;
    mAvatarPath = Environment.getExternalStorageDirectory()+"/BiBi/"+
            BmobInstallation.getInstallationId(activity)+"_avatar.jpg";
    PrefUtils.putString(activity, ConsUtils.AVATAR, mAvatarPath);
}
 
开发者ID:JoeSteven,项目名称:BiBi,代码行数:7,代码来源:AvatarUtils.java


注:本文中的cn.bmob.v3.BmobInstallation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。