I'm making a Live Query subscription when a new message is created. Problem is parseQuery.include("sender") is not working as intended. Therefore, print(sender.getString("username")!!) fires an error because username field does not exist.
val parseQuery = ParseQuery.getQuery<ParseObject>("messages")
parseQuery.include("sender")
val subscriptionHandling: SubscriptionHandling<ParseObject> = app.parseLiveQueryClient!!.subscribe(parseQuery)
subscriptionHandling.handleEvent(SubscriptionHandling.Event.CREATE) { query, `object` ->
val handler = Handler(Looper.getMainLooper())
handler.post {
val message = `object` as ParseObject
val sender = `object`.getParseObject("sender") as ParseUser
print(sender.getString("username")!!)
}
}
My Messages class has 'sender' as a Pointer to _User's objectId.
I'm making a Live Query subscription when a new message is created. Problem is
parseQuery.include("sender")
is not working as intended. Therefore,print(sender.getString("username")!!)
fires an error because username field does not exist.My Messages class has 'sender' as a Pointer to _User's objectId.