解析Android:了解云代码并进行部署

时间:2015-12-26 13:02:01

标签: android parse-platform cloud-code

我的应用很简单,因为它需要四个步骤

第1步: UserA可以创建问卷并将其发送给userB。

第2步: UserB收到问卷,其中有三个选项,单选按钮

第3步: UserB选择单选按钮中显示的首选答案,然后单击“提交按钮”

第4步: 点击提交按钮后,userA会收到一封来自userB的回复电子邮件

但是,我使用解析这个应用程序,我刚开始学习云代码以及如何使用它,因为 我正在尝试从用户表中获取发件人的(UserA)电子邮件< / em> 但我仍然没有得到理想的结果,因为我觉得我错过了什么

我的main.js

   Parse.Cloud.define("getEmail", function(request, response) {
    Parse.Cloud.useMasterKey();

    var userQuery = new Parse.Query(Parse.User);
    var senderName = userEmail.get("senderId");
    userQuery.equalTo("email", request.params.email);
    userQuery.get("email", {
success: function(userEmail) {
    // the object was retrieved 
    if ( email == senderName) {
        status.message(email + "found");
        return getEmail.save;
    } 
     else {
        status.message("Invalid email address");
    }
}, 
  error: function(object, error) {
status.error("something went wrong")
}

});
});

我的机器人,云代码功能

private void callCodeCloud() {
    HashMap<String, String> params = new HashMap<String, String>();
    params.put("objectId", objectId);
    params.put("email", email);

    ParseCloud.callFunctionInBackground("getEmail", params, new FunctionCallback<String>() {

        public void done(String email, ParseException e) {
            if (e == null) {
                Toast.makeText(getApplication(), "Vote Sent", Toast.LENGTH_SHORT).show();
            } else {
                Toast.makeText(getApplication(), "Error", Toast.LENGTH_SHORT).show();

            }
        }
    });
}


private String returnVoteAnswer() {
    int nIdRadio = radioVoteGroup.getCheckedRadioButtonId();
    if (nIdRadio == R.id.optionone) {
        optionONE.setText(mO);
        callCodeCloud();
    }
    else if (nIdRadio == R.id.optiontwo) {
        optionTWO.setText(mT);
        callCodeCloud();
    }
    else if (nIdRadio == R.id.optionthree) {
        optionTHREE.setText(mH);
        callCodeCloud();
    }
    else{
        }
    return null;
    }

我一直在努力解决这个问题,我需要指导。通过完成这个应用程序,这对我来说真是太棒了,因为这个问题已经成为我完成这个应用程序的障碍。 提前致谢

0 个答案:

没有答案