コード例 #1
0
ファイル: Setting.java プロジェクト: ems123/freeminder
    @Override
    protected HashMap<String, Object> doInBackground(String... strings) {

      Log.d("Settings.java", "saving settings on parse ");

      Log.d(
          "Settings.java",
          "updating details to parse : "
              + bname
              + " "
              + username
              + " "
              + email
              + " "
              + mobile
              + " "
              + service);

      HashMap<String, Object> params = new HashMap<String, Object>();
      params.put("userId", parseObjectId);
      params.put("username", name);
      params.put("service", strservice);
      params.put("mobile", strnumber);
      params.put("password", strpassword);
      params.put("email", stremail);

      try {

        updateUser = ParseCloud.callFunction("updateUser", params);
        Log.d("DBHandler", " object:" + updateUser);

      } catch (ParseException e) {
        e.printStackTrace();
        String Msg = e.getMessage();
        try {
          JSONObject parseJsonMsg = new JSONObject(Msg);
          ParseMessage = parseJsonMsg.getString("message");
        } catch (JSONException excep) {
          excep.printStackTrace();
        }
        Log.d("Setting.java", "exception message :" + ParseMessage);
      }

      return updateUser;
    }
コード例 #2
0
 private void sendPushToEmployee(String requestId, String employeeId) {
   Map<String, Object> params = new HashMap<>();
   params.put("requestId", requestId);
   params.put("employeeId", employeeId);
   ParseCloud.callFunctionInBackground(
       "sendPushToEmployee",
       params,
       new FunctionCallback<Object>() {
         @Override
         public void done(Object o, ParseException e) {
           if (e == null) {
             Log.d("SUCCESS: ", o.toString());
             // finish();
           } else {
             Log.e("ERROR: ", e.getMessage());
           }
         }
       });
 }
コード例 #3
0
  private void getDataSet() {
    ParseUser user = ParseUser.getCurrentUser();
    if (user != null) {
      ParseCloud.callFunctionInBackground(
          "getTransportsByCurrentUser",
          new HashMap<String, Object>(),
          new FunctionCallback<Object>() {

            @Override
            public void done(Object object, ParseException e) {
              if (e == null) {
                try {
                  JSONArray jArray = new JSONArray(object.toString());
                  Log.d("DEBUG", "PC: " + jArray.toString());

                  for (int i = 0; i < jArray.length(); ++i) {
                    JSONObject jObj = jArray.getJSONObject(i);
                    String objectId = jObj.getString("objectId");
                    String source = jObj.getString("source");
                    String destination = jObj.getString("destination");
                    Integer slotsAvailable = Integer.parseInt(jObj.getString("slotsAvailable"));
                    String date = jObj.getString("date");
                    date = date.substring(0, date.indexOf("T"));

                    ((MyTransportsRecyclerViewAdapter) mAdapter)
                        .addItem(
                            new Transport(source, destination, date, slotsAvailable, objectId), 0);
                  }
                  mAdapter.notifyDataSetChanged();
                } catch (JSONException ex) {
                  Log.d("DEBUG", ex.getMessage());
                }
                Log.d("DEBUG", "PC: " + object.toString());
              } else {
                Log.d("DEBUG", "PC: " + e.getMessage());
              }
            }
          });
    }
  }
コード例 #4
0
  private void sendPushToClient(
      String date,
      String userID,
      String serviceName,
      String imageUrl,
      String problemDesc,
      String attendedBy) {
    Map<String, Object> params = new HashMap<>();
    params.put("client", userID);
    params.put("date", date);
    params.put("homeServiceName", serviceName);
    params.put("imageUrl", imageUrl);
    params.put("problemDescription", problemDesc);
    params.put("attendedBy", attendedBy);
    params.put("attendedByAvatar", attendedByAvatar);
    ParseCloud.callFunctionInBackground(
        "sendPushToClient",
        params,
        new FunctionCallback<Object>() {
          @Override
          public void done(Object o, ParseException e) {
            if (e == null) {
              Log.d("SUCCESS: ", o.toString());
              // finish();

            } else {
              // TODO mostrar opcion de reenviar la notificacion y no hacerlo volver al menu
              // principal para comenzar el procedimiento desde cero
              Log.e("ERROR: ", e.getMessage());
              TextView textViewOrderSent =
                  (TextView) orderSent.findViewById(R.id.textview_notification);
              if (textViewOrderSent != null) {
                textViewOrderSent.setText(getResources().getString(R.string.order_not_sent));
              }
            }
          }
        });
  }