Hi,
In my android app, I’m getting the error “BackendlessException{ code: ‘Internal client exception’, message: ‘timeout’ }” intermittently. In my app, I have a fragment for data entry. It has 5 edittext fields and a done menu button. I’m using the Backendless.Persistence.of(MyClass.class) on an IntentService which I call on when I press the done button.
Not sure if this is the cause but does going beyond the limitation for the api call trigger this error as well?
Here’s the code I’m using for my intent. The error is coming from the line “MyClass newMyClass = Backendless.Persistence.of(MyClass.class).save(myClass);”
public class MyClassPushService extends IntentService {
public MyClassPushService() {
super("MyClassPushService");
}
@Override
protected void onHandleIntent(Intent intent) {
MyClass myClass = (MyClass) intent.getSerializableExtra(MyClass.class.getName());
if (myClass != null) {
// Check whether the record is already in the cloud
QueryOptions queryOptions = new QueryOptions();
queryOptions.setPageSize(1);
BackendlessDataQuery dataQuery = new BackendlessDataQuery(queryOptions);
dataQuery.setWhereClause(String.format("id = '%s'",myClass.getId()));
BackendlessCollection<MyClass> myClassBackendlessCollection = Backendless.Persistence.of(MyClass.class).find(dataQuery);
if (myClassBackendlessCollection.getTotalObjects() > 0) {
myClass.setObjectId(myClassBackendlessCollection.getData().get(0).getObjectId());
}
if (myClass.getCategory().getObjectId() == null) {
queryOptions = new QueryOptions();
queryOptions.setPageSize(1);
dataQuery = new BackendlessDataQuery(queryOptions);
dataQuery.setWhereClause(String.format("id = '%s'", myClass.getCategory().getId()));
BackendlessCollection<MyClassCategory> categoryBackendlessCollection = Backendless.Persistence.of(MyClassCategory.class).find(dataQuery);
if (categoryBackendlessCollection.getTotalObjects() > 0) {
myClass.setCategory(categoryBackendlessCollection.getData().get(0));
}
}
try {
DatabaseHelper databaseHelper = OpenHelperManager.getHelper(this, DatabaseHelper.class);
Dao<MyClass, String> daoMyClass = databaseHelper.getDaoMyClass();
MyClass newMyClass = Backendless.Persistence.of(MyClass.class).save(myClass);
daoMyClass.createOrUpdate(newMyClass);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
Regards,
Allen