Support Topics Documentation Slack YouTube Blog

Publish message error in some device! code: Internal client exception


(Reza Ahmadi) #1

Hi
I’d like to send push notification from my android app.it’s work fine in some device but in some device it receive push very well but can’t publish push and got this error: Internal client exception.
this is my code:
Backendless.initApp(this, “my_applicationId”, “my_secretKey”, appVersion);

Backendless.Messaging.registerDevice(“my_GCM_sender_id”, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void arg0) {
new Thread(new Runnable() {
@Override
public void run() {
try {
MessageStatus status=Backendless.Messaging.publish(“defult”, “message text”);
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
@Override
public void handleFault(BackendlessFault arg0) {
Log.i(“GCM”, “=”+arg0.getMessage());
}
});


(Mark Piller) #2

See the section marked as “IMPORTANT” at:

https://backendless.com/documentation/messaging/android/messaging_sync_and_async_calls.htm


(Reza Ahmadi) #3

thanks mark.i know about sync and async call and i try all ways.
i said it’s work fine in some device.i think maybe that devices block publish message because other backendless calls work very well.i got this error only when wants to publish message on some device.


(Mark Piller) #4

You’re using the sync version of Backendless.Messaging.publish. You will get that exception on any device that runs Android for the reason described in the documentation.


(Reza Ahmadi) #5

i try this too but got same result:
DeliveryOptions deliveryOptions = new DeliveryOptions();
deliveryOptions.addPushSinglecast(Device_ID);
Backendless.Messaging.publish(“defult”, content, publishOptions, deliveryOptions, new AsyncCallback<MessageStatus>() {
@Override
public void handleResponse(MessageStatus messageStatus) {
Log.i(“Send Ok”, “=” + messageStatus.getStatus() + “–” + messageStatus.getErrorMessage());

}

@Override
public void handleFault(BackendlessFault backendlessFault) {
    Log.i("Send Error", "=" + backendlessFault.getMessage() + "-code=" + backendlessFault.getCode()
    +"-detil="+backendlessFault.getDetail());
}

});


(Mark Piller) #6

What is the result? Is there a stack trace? Perhaps an error code?


(Reza Ahmadi) #7

no just it :
code:internal client exception
message:null
detail:null


(Mark Piller) #8

Please debug it and see which line of code causes the exception. Let us know what you find.


(Reza Ahmadi) #9

06-25 00:43:21.979 W/System.err: BackendlessException{ code: ‘Internal client exception’, message: ‘null’ }
06-25 00:43:21.979 W/System.err: at com.backendless.Invoker$SyncResponder.errorHandler(Invoker.java:127)
06-25 00:43:21.979 W/System.err: at com.backendless.core.responder.AdaptingResponder.errorHandler(AdaptingResponder.java:93)
06-25 00:43:21.979 W/System.err: at weborb.client.ioEngine.HttpIOEngine.send(HttpIOEngine.java:213)
06-25 00:43:21.979 W/System.err: at weborb.client.ioEngine.HttpIOEngine.invoke(HttpIOEngine.java:145)
06-25 00:43:21.979 W/System.err: at weborb.client.WeborbClient.invoke(WeborbClient.java:138)
06-25 00:43:21.979 W/System.err: at com.backendless.Invoker.invokeSync(Invoker.java:100)
06-25 00:43:21.979 W/System.err: at com.backendless.Invoker.invokeSync(Invoker.java:112)
06-25 00:43:21.979 W/System.err: at com.backendless.Messaging.publish(Messaging.java:423)
06-25 00:43:21.979 W/System.err: at com.backendless.Messaging.publish(Messaging.java:387)
06-25 00:43:21.979 W/System.err: at com.backendless.Messaging.publish(Messaging.java:366)


(Mark Piller) #10

This tells me that your code still invokes the synchronous version of the method. Here, take a look, line 423 in Messaging.java is right in the sync version of “publish”:


(Reza Ahmadi) #11

finally i found the problem.
error occurred when both device use of same wifi network.but when network is different both device work very well.
Mark can you solve this problem? it’s very necessary,because my app is an social network and it’s possible people of a family use of app and then they can’t send message on their wifi network.


(Mark Piller) #12

The problem with “internal client exception” has nothing to do with what network you use. It occurs only if you use sync api on the main UI thread in Android.

We’d be happy to look into the problem in your code. Since this is outside of the free support, you’d need to purchase “single-incident support” as described at: https://backendless.com/support-policy/

Mark