Service worker in ionic1



I would like add service worker to my project in ionic 1. Is it possible?

I used this code and I have a error

service worker error DOMException: Failed to register a ServiceWorker: The URL protocol of the current origin (‘file://’) is not supported.

Service worker needs https so how it works in ionic 2?