refresh google cloud endpoint in android studio

136 Views Asked by At

i'm using android studio 1.2.2 to create an android app that relies on a google cloud backend. i managed to create the app and the backend, to generate backend endpoint to persist data bu now i have added a new constructor to the entity class (to pass parameters that will initialize the object) but i am not able to refresh the api version of this class in the library generated, so there is no new constructor and i can't use. what are the steps to refresh the contents of this library? thanks in advance

FROM

@Entity
public class Coordinates {
@Id
String email;
double latitude;
double longitude;
String timestamp;

public Coordinates(){}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public double getLatitude() {
    return latitude;
}

public void setLatitude(double latitude) {
    this.latitude = latitude;
}

public double getLongitude() {
    return longitude;
}

public void setLongitude(double longitude) {
    this.longitude = longitude;
}

public String getTimestamp() {
    return timestamp;
}

public void setTimestamp(String timestamp) {
    this.timestamp = timestamp;
}
}

TO

@Entity
public class Coordinates {
@Id
String email;
double latitude;
double longitude;
String timestamp;

public Coordinates(){}

public Coordinates(String email,double latitude,double longitude,String timestamp) {
    this.email=email;
    this.latitude=latitude;
    this.longitude=longitude;
    this.timestamp=timestamp;
}

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public double getLatitude() {
    return latitude;
}

public void setLatitude(double latitude) {
    this.latitude = latitude;
}

public double getLongitude() {
    return longitude;
}

public void setLongitude(double longitude) {
    this.longitude = longitude;
}

public String getTimestamp() {
    return timestamp;
}

public void setTimestamp(String timestamp) {
    this.timestamp = timestamp;
}
}
1

There are 1 best solutions below

2
On

When you generate your endpoints JAR to be used in Android it does not transfer all the methods or constructors. I don't know the reason for that, probably written somewhere but haven't seen it.

I believe you have two options:

  1. Use your Coordinates class without special constructor, ie use getters and setters
  2. Create Coordinates class in Android app and have a helper class which converts your Android App Coordinates class into Endpoint Coordinates class