Cordova-plugin-advanced-http not working with certificate

I have an application that uses a backend with a self-signed certificate. I’m trying to accomplish the communication between the server and the app using the cordova-plugin-advanced-http and the method (obsolete – the wrapper is not updated) setSSLCertMode('pinned'). I do not understand where I have to put the certificate .cer file: for now I’ve wrote this in the config.xml file
<resource-file src="src/assets/certificates/cert.cer" target="app/src/main/assets/www/certificates/cert.cer" />.
The problem is: it is not working, even with the certificate each call to my backend returns the error

"TLS connection could not be established: Hostname XX.XX.XX.XX not verified:
    certificate: sha1/YYY//WWWWWWW
    DN: CN=mydomain,O=Default Company Ltd,L=Default City,ST=MyCity,C=IT
    subjectAltNames: []"

I’ve been working on this for 2 days, what am I missing?

Sorry my bad: the problem was from the certificate. In fact the problem was related to this: Adding the IP in the subjectAltName resolved the problem.