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

json exception #10

Closed guoyoujin closed 9 years ago

guoyoujin commented 9 years ago

How are you, The result is not a valid json data, it for more than two " "

if (listener instanceof ResultListener) { mListeners.remove(id); final String result; if (data.has(Protocol.Field.RESULT)) { result = data.get(Protocol.Field.RESULT).toString(); } }

ocram commented 9 years ago

Thanks! Could you please provide some more details on this problem?

Where is this code from? Is it from the library or from your custom code?

If there's an exception, can you post the stack trace?

guoyoujin commented 9 years ago

From meteor. Java file

guoyoujin commented 9 years ago

I want to query databse user _id = 10 user query data? How to implement? can you help me?

ocram commented 9 years ago

Finding an entry from users where _id = 10 would be something like this in MongoDB:

db.users.find({ _id: 10 })

With this library, the equivalent would be similar to the following:

Map<String, Object> query = new HashMap<String, Object>();
query.put("_id", 10);
mMeteor.call("/users/find", query);
guoyoujin commented 9 years ago

Thank you, I have solve this problem

isdzulqor commented 8 years ago

@guoyoujin could you tell me how you solve your problem, the slash at the beginning is only needed when accessing collections, so how do you handle the method in server because it's started with slash and need a return data, and how do you handle the data,, can you give me some example code, please,

ocram commented 8 years ago

@isdzulqor Sorry, the example was probably wrong. As we found out in the other issues already, you can't call the find method. You really have to use subscriptions and onDataAdded(...).

Nevertheless, it would be interesting to know how you solved your problem, @guoyoujin -- that's right :)

isdzulqor commented 8 years ago

@mwaclawek yeah,, I have found my solution and it's solved

guoyoujin commented 8 years ago

@isdzulqor Sorry, what is more, these days I was not pay attention to the mail, you can look at my code, though he is written using Chinese https://github.com/guoyoujin/learning-android-ddp