Hi,
I’m currently trying to receive/remove a LineString from my database once it is approved/disapproved and reflect that on my Android application, however every time I approve or disapprove my app crashes giving the error:
Application ID: 99C0754B-6B4E-417F-FF30-6281C4DFFB00
java.lang.RuntimeException: Can not create BackendlessGeometry from type weborb.reader.CacheableAdaptingTypeWrapper
at com.backendless.persistence.BackendlessGeometryFactory.createObject(BackendlessGeometryFactory.java:61)
at weborb.util.ObjectFactories._createArgumentObject(ObjectFactories.java:145)
at weborb.util.ObjectFactories.createArgumentObject(ObjectFactories.java:132)
at weborb.reader.AnonymousObject.getPropertyValue(AnonymousObject.java:501)
at weborb.reader.AnonymousObject.setFieldsDirect(AnonymousObject.java:434)
at weborb.reader.AnonymousObject.adaptToClass(AnonymousObject.java:291)
at weborb.reader.AnonymousObject.adapt(AnonymousObject.java:140)
at weborb.reader.AnonymousObject.adapt(AnonymousObject.java:134)
at weborb.reader.CacheableAdaptingTypeWrapper.adapt(CacheableAdaptingTypeWrapper.java:47)
at com.backendless.rt.data.EventHandlerImpl$5.handleResponse(EventHandlerImpl.java:499)
at com.backendless.rt.data.EventHandlerImpl$5.handleResponse(EventHandlerImpl.java:487)
at com.backendless.async.message.AsyncMessage$ResponseHandler.handle(AsyncMessage.java:64)
at com.backendless.async.message.AsyncMessage.handleCallback(AsyncMessage.java:41)
at com.backendless.core.AndroidCarrier$1.handleMessage(AndroidCarrier.java:37)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8757)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
I’m confused as I am able to retrieve the LineStrings initially just fine, and I am also able to change other properties for that particular object, such as likes and have it reflect on the Android app just fine as well. Furthermore, I am also able to delete the object from Backendless.com and have it reflect on my application too.
I have two functions that are for the approval functionality here:
override suspend fun observeApproval(): Flow<PointSet> {
return callbackFlow {
Log.d("observeApproval", "here")
val event = backendless.of(PointSet::class.java).rt()
val callback = object : AsyncCallback<PointSet> {
override fun handleResponse(response: PointSet) {
Log.d("observeApproval", response.toString())
trySendBlocking(response)
}
override fun handleFault(fault: BackendlessFault?) {
Log.d("observeApproval", fault.toString())
fault?.message?.let { cancel(message = it) }
}
}
event.addUpdateListener("approved = false or approved = true", callback)
awaitClose {
event.removeUpdateListeners()
}
}
}
and
private fun observeApproval() { // Observes or "listens" to changes for a PointSet based on approval/disapproval
viewModelScope.launch(Dispatchers.IO) {
repository.observeApproval().collect { set ->
Log.d("observeApproval", "${set.points.toString()}")
if (set.approved) {
pointSets.add(set)
} else {
pointSets.removeAll {
it.objectId == set.objectId
}
}
}
}
}
Any help or explanation would be appreciated! Thank you!