
Since the HTTPS certificate includes the current IP address in it, it needs to be regenerated each time that the IP address changes. It also can take a long time to run, especially on the first time, since it had to do things like create a key pair and make the certificate. Therefore it should be in a Service/AsyncTask.