delight-im / Android-DDP

[UNMAINTAINED] Meteor's Distributed Data Protocol (DDP) for clients on Android
Apache License 2.0
274 stars 54 forks source link

Object would be serialized to `null` issue #106

Closed sayed19 closed 8 years ago

sayed19 commented 8 years ago

I have a sign up option for my application where i call a custom method which upload the user information to the meteor server. It was working flawlessly. Suddenly it is no longer working. My app is crashing whenever I try to sign up. It is throwing an error "Object would be serialized to null". I believe it is something to do with the 'send' method of the ddp. How do I overcome this problem. Have anyone faced it before. Please shed some light as early as possible.

ocram commented 8 years ago

Thanks for your report!

Now that you closed the issue, could you explain what was wrong here? Has this been a bug in this library? Or has there been something you could fix in your application code?

Thank you!

renehauck commented 7 years ago

I just had the same problem :smiley: The reason was this code:

...
Object[] args={new UpdatePositionObject(location.getLatitude(),location.getLongitude())};
mMeteor.call(methodeName,args);
...

class UpdatePositionObject{
    private final double lat;
    private final double lng;

    public UpdatePositionObject(double lat, double lng){
       this.lat=lat;
        this.lng=lng;
    }
}

After i changed the call to this: mMeteor.call(methodeName,new Object[] { location.getLatitude(),location.getLongitude() }); it works like a charm. :+1:

ocram commented 7 years ago

Thanks for explaining what was the issue here, @renehauck!

Since this issue stems from problems with the data types again, I've added some notes about the available data types to the README: https://github.com/delight-im/Android-DDP/commit/af8e26c633e3372cea43acab797c4c5b6552e793