Dynamic SSL pinning: Write a certificate file in the src folder at runtime

i am trying to implement SSL pinning in my ionic application, to do this i need to specify the certificate location at build time using:

<resource-file src="src/certificates/certificate.cer" target="src/certificates/certificate.cer" />

As you might know the certificate has expiry date, so i am trying to load it dynamically, is it possible to specify the location of the certificate and download it at runtime ? if not is there any other way i can implement the SSL pinning dynamically in ionic?