I deployed a pwa version of my ionic 4 app. It works great but there is a problem with my app. If I add my app to my android home screen there is a small browser icon for example Chrome icon in the bottom right of my app icon. I saw this link:
How to Remove Chrome Logo from PWA App Home Screen Link (Android O Preview)
And then checked my application tab on google developers tools and I saw in the Manifest section the instability has a warning icon that show me this message: "No matching service worker detected. You may need to reload the page or check that the service worker for the current page also controls the start url from the manifest"
Even though there is my service worker in the folder, It seems that service worker not found by application!
Could you please help me to over come this issue?
UPDATE:
I found that this issue related to my lokijs database initialization. If I comment db initialization the service worker will be registered. I don't undrestand why this is happening. Is this mean that lokijs is not working with service worker?
for more info this is my db init inside lokijs service:
initDB = () => {
return new Observable((subs) => {
const adapter = new LokiIndexedAdapter('roxanne', { closeAfterSave: true });
this.db = new Loki('roxanne_db', {
autosave: true,
adapter: adapter
});
this.db.loadDatabase({}, (err) => {
if (err) {
console.log(err);
} else {
console.log('db was initialized');
subs.next();
}
});
});
And I subscribe to this in my app.component.ts like this:
this.lokiService.initDB().subscribe(result => {
console.log(result);
// this.lokiService.checkDbCollections();
}, err => console.log(err));
Is there a problem with my code or I have to consider another DB for my project?
Thanks