Hi All,
Interesting one, we’re calling custom business logic from the android sdk, for some reason when passing Booleans to the custom bl they always come in as null.
Scenario:
We have a table in Backendless called ‘Information’ with schema:
We have a custom business logic code that updates the objects in Information:
public static Boolean updateBarInformation(Information barInf, String Bar_ID){
barInf.save();
return true;
}
We call this code from the Android SDK:
When the request hits the custom bl logic we see this:
For some reason the Booleans are being converted to null…
This is the class on the Android client:
What’s interesting is, we use this code everyday on the iPhone SDK and it works completely fine, no issues with Booleans becoming null, this leads me to think that there is an issue within the Android sdk.
Hello @Reece_Smith
Thanks for the report. We are investigating the problem. Please tell us the version of the Android SDK you are using.
Regards,
Inna
Hi Inna,
We’ve tried multiple version from 6.3.0 all the way down to 5.7.
@Reece_Smith
In business logic, do you use a custom servicer or an event handler?
@Reece_Smith
An internal ticket BKNDLSS-25732 for your topic has been created. We will let you know about solution.
Regards,
Inna
Thanks Inna, this is blocking us releasing our Android app at the moment, if possible can you give it high priority.
Thanks
Hello @Reece_Smith
In which app does this happen, 08B538C0-0E98-1827-FF98-7DF8AFF96600 or AFF18CB4-DF5E-430B-8BEE-1AF97113767C?
Hi @Volodymyr_Ialovyi
It’s on our Dev app AFF18CB4-DF5E-430B-8BEE-1AF97113767C - it works fine using the iPhone SDK on this application. Its just when using the Android SDK we have the issue.
(Not tested on prod, but I can’t see the situation being any different in prod)
Hello @Reece_Smith
Please add setter for objectId to class Information.
public void setObjectId( String objectId )
{
this.objectId = objectId;
}
Then try again.
Please write about the result.
Hi @Volodymyr_Ialovyi
This is already set please see the screenshot above.
It’s only impacting Booleans, we’ve tried on multiple tables, the string datatypes arrive on the api fine, its just the booleans that are hitting the custom api service as null
Hello @Reece_Smith
I saw your screenshot.
I checked in your code and didn’t find a setter there.
Hello @Reece_Smith
Try to reproduce with the following scenario:
- Deploy API service with the following classes
DemoService.class
import com.backendless.servercode.IBackendlessService;
public class DemoService implements IBackendlessService
{
public void saveObjectWithBoolColumns() throws InterruptedException
{
Table1 table1 = new Table1( "5D21472E-2C62-4277-A963-D0103B566694", true );
table1.save();
}
}
Table1.class
import com.backendless.Backendless;
public class Table1
{
private String objectId;
private Boolean bool1;
public Table1()
{
}
public Table1( String objectId, boolean bool1)
{
this.objectId = objectId;
this.bool1 = bool1;
}
public String getObjectId()
{
return objectId;
}
public void setObjectId( String objectId )
{
this.objectId = objectId;
}
public Boolean getBool1()
{
return bool1;
}
public Table1 save() {
return Backendless.Data.of( Table1.class ).save(this );
}
}
- Invoke saveObjectWithBoolColumns
Do you reproduce the error in this scenario?
I don’t think you understand the issue, you’re setting the booleans on the business logic side, so it will work fine. You need to call the business logic from an android client using the android sdk.
I made a diagram to help understand the issue:
Hello @Reece_Smith
Could you provide the simplest steps to reproduce the problem?
The Demo Service must contain a MyTable, right?
Yes when you download your demo service the class will come down with the package
MyTable.class in Demo Service look like:
import com.backendless.Backendless;
public class MyTable
{
private String objectId;
private Boolean bool1;
public MyTable()
{
}
public MyTable( String objectId, Boolean bool1 )
{
this.objectId = objectId;
this.bool1 = bool1;
}
public String getObjectId()
{
return objectId;
}
public void setObjectId( String objectId )
{
this.objectId = objectId;
}
public Boolean getBool1()
{
return bool1;
}
public void setBool1( Boolean bool1 )
{
this.bool1 = bool1;
}
public MyTable save()
{
return Backendless.Data.of( MyTable.class ).save( this );
}
}
right?
Looks good to me.
I made a screenshot of the issue too that might help show the issue: