I got this error from XPMobileSDK.XProtectMobileSDK: Mobile Server does NOT give its public key!How to fix?

Can you give us a little more context ? What commands are you calling. What parameters are you sending? Which SDK are you using: JS, .NET, Andoid or IOS?

I use XPMobileSDK for Android.

My server is http.

This’s my code.

sdkPlayback = new SDKPlaybackApplication();

URL connectionUrl = null;

try {

connectionUrl = new URL(“https”, serverAddress, serverPort, “”);

} catch (MalformedURLException e) {

e.printStackTrace();

}

sdkPlayback.xpMobileSDK = new XPMobileSDK(this,connectionUrl, communicationAlias, null, null, false, new LiveMsgCallback() {

@Override

public void liveMessageResponse(CommunicationCommand communicationCommand) {

}

@Override

public void messageFromServer(String s, String s1, List list, String s2) {

}

}, false);

Thread thread = new Thread() {

@Override

public void run() {

sdkPlayback.xpMobileSDK.logIn(username,password,new SuccessCallback() {

@Override

public void onSuccess(CommunicationCommand communicationCommand) {

sdkPlayback.xpMobileSDK.getAllViewsAndCameras(new SuccessCallback() {

@Override

public void onSuccess(CommunicationCommand communicationCommand) {

for(int x = 0; x < sdkPlayback.allAvailableCameras.size();x++) {

CommunicationItem temp = sdkPlayback.allAvailableCameras.get(x);

if (temp.getType().equals(“camera”)) {

Log.d(“CAMERA”,“Name=” + temp.getName() + " CameraID=" + temp.getId());

}

}

}

},new ErrorCallback() {

@Override

public void onErrorOccurred(CommunicationCommand communicationCommand) {

}

});

}

},new ErrorCallback() {

@Override

public void onErrorOccurred(CommunicationCommand communicationCommand) {

}

});

}

};

thread.start();

Thank you.

Hello,

In the posted code, I can see you are calling login, but I don’t see a call to connect before that.

You should call connect first, and only login after that.

The mobile server will send its public key on connect.

You can also check the samples bundled with the Mobile SDK - eg. LiveVideoSample for an example how it’s done.

Hope that helps :slight_smile:

Plamen

Fixed

Thank you.