如何等待ParseCloud.callFunctionInBackgroud

时间:2016-07-17 08:28:10

标签: parse-platform parse-server parse-cloud

我有一个Utility函数,用于检查用户是否进行了少量操作。如果没有,那么我需要将结果发送回MainActivity。

public static boolean checkUserIsDone(String receiverPhoneNumber, String senderNumber ) {
    hasApp = false;
    HashMap<String, Object> parseParams = new HashMap<>();
    parseParams.put("phoneNumber", receiverPhoneNumber);
    parseParams.put("senderNumber", senderNumber);
    ParseCloud.callFunctionInBackground("GetUserByPhoneNumber", parseParams, new FunctionCallback<String>() {
        public void done(String result, ParseException e) {
            if (e == null && result.equals("success")) {
                hasApp = true;
            } else {
                hasApp = false;
                Log.e("Error: ", e.getMessage());
            }
        }
    });
    return hasApp;
} 

0 个答案:

没有答案