コード例 #1
0
 /** registra un nuovo device */
 public boolean registerNewDevices(
     String sGCMId, String sAge, String sWeight, String sGender, String sName, String sNick) {
   MySQLHelper oMySql = new MySQLHelper();
   if (oMySql.Connect()) {
     // Prima verifico se esiste e poi eventualmente ricreo
     oMySql.insertUpdateSQL("DELETE FROM androidtrainer.users WHERE gcmid='" + sGCMId + "'");
     if (oMySql.insertUpdateSQL(
         "INSERT INTO androidtrainer.users (gcmid,age,weight,gender,name,nick) values ('"
             + sGCMId
             + "','"
             + sAge
             + "','"
             + sWeight
             + "','"
             + sGender
             + "','"
             + sName
             + "','"
             + sNick
             + "')")) {
       System.out.println("registered ner device");
     } else {
       return false;
     }
     oMySql.Disconnect();
   } else {
     if (oMySql.isConected()) oMySql.Disconnect();
     return false;
   }
   return true;
 }
コード例 #2
0
  /** registra un nuovo partecimante alla VirtualRace */
  public boolean newWatchPointForVirtualRace(
      String sGCMId,
      int iVirtualRace,
      double dLatidute,
      double dLongitude,
      float fAlt,
      float fSpeed,
      double dDistance,
      Long lTime,
      String sLocale) {
    MySQLHelper oMySql = new MySQLHelper();

    if (oMySql.Connect()) {
      if (oMySql.insertUpdateSQL(
          "INSERT INTO androidtrainer.virtualrace (gcmid,id_virtual_race,latidute,longitude,alt,pace,distance,time,locale) values"
              + " ('"
              + sGCMId
              + "',"
              + iVirtualRace
              + ","
              + dLatidute
              + ","
              + dLongitude
              + ","
              + fAlt
              + ","
              + fSpeed
              + ","
              + dDistance
              + ","
              + lTime
              + ",'"
              + sLocale
              + "')")) {
        System.out.println("registered ner device");
      } else {
        return false;
      }
      oMySql.Disconnect();
    } else {
      if (oMySql.isConected()) oMySql.Disconnect();
      return false;
    }
    return true;
  }