Backendless Support
 
Answered

Error when sending messages from one device to another,

Hi,

When sending messages from one device to another, when the sender is Android 4.4 or lower I get the error message:

"java.lang.ClassCastException: java.util.HashMap cannot be cast to com.backendless.messaging.MessageStatus

at apps.jmm.cat.sharemyneed.Respuesta$24.handleResponse(Respuesta.java:1994)

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:98)

at android.os.Looper.loop(Looper.java:136)

at android.app.ActivityThread.main(ActivityThread.java:5333)

at java.lang.reflect.Method.invokeNative(Native Method)

at java.lang.reflect.Method.invoke(Method.java:515)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:711)

at dalvik.system.NativeStart.main(Native Method)"

This does not happen with devices of Android versions higher than 4.4 since both the sendings and receptions work perfectly.From a device with Android 4.4 or lower the messages are correctly received and also sent correctly since the receiver receives them but the error appears and the application stops working.I have looked at all the topics that already exist in your database and I have tried with the example projects that you indicate but I continue having the problem and I do not know what else to try !!

My sending statement:

List<String> devices = new ArrayList<>();

devices.add(deviceToSend);DeliveryOptions deliveryOptions = new DeliveryOptions();deliveryOptions.setPushSinglecast(devices);

PublishOptions publishOptions = new PublishOptions();

publishOptions.putHeader( "usuarioEmisor", global.nombreUsuario );

publishOptions.putHeader( "usuarioReceptor", global.nombreUsuarioDestino );

Backendless.Messaging.publish((Object) global.mensajeParaEnviar, publishOptions, deliveryOptions, new AsyncCallback<MessageStatus>() {

public void handleResponse(MessageStatus response) {

System.out.println("Mensaje ok : ");

}

public void handleFault(BackendlessFault backendlessFault) {

System.out.println("Mensaje ko : " + backendlessFault.getDetail());

}

});

By the way, I´m using the backendless-4.4.0-javadoc library.

Regards,

Leave a Comment

Comments (1)

photo
1

Hi, Joan.

We support our android library for os level higher than API-21 (Android 5.0 Lollipop).

Google itself doesn't support such old os (i mean bug and security patches).