I am working on a data collection application for Android and I am able to use CartoSQLService to read information from my table in Carto, however I am having difficultly adding data. I have searched online for any guidance with no luck.
Does anyone know the proper procedure to add data to a Carto table using the Carto Mobile SDK? Is the API Key suppose to be included? If so, how is this done since the Carto documentation does not show how this is accomplished for Android applications?
Here is what I have so far:
final CartoSQLService service = new CartoSQLService();
service.setAPITemplate("https://{username}.carto.com");
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
service.queryData("INSERT INTO {table_name} (lat,long,sod) VALUES (" + locArray[0] + "," + locArray[1] + "," + checkBox.isChecked() + ")");
} catch (IOException e) {
e.printStackTrace();
}
}});
thread.start();
Error:
E/carto-mobile-sdk: HTTPClient::makeRequest: Bad status code: 401, URL:
{
"error": [
"permission denied for relation acorn_table"
]
}
{}
button that enables you to format any highlighted code nicely.