Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I keep my app from going inactive?

In my manifest I have:

"app": 
{
    "background": 
    {
        "scripts": 
        [
            "main.js"
        ],
        "persistent": true
    }
}

but it still shows Inspect views: _generated_background_page.html (Inactive) and when I look at the console, it is inactive.

And I also have a setInterval running every 10 seconds. Yet, it still goes inactive!

What do I need to do to keep it from going inactive?

Additional Info:

I added an alarm that fires every minute and this appears to wake my app up. (Need to do more testing) But it means waiting a minute after Chrome startup before the app runs.

like image 846
Don Rhummy Avatar asked Nov 24 '22 21:11

Don Rhummy


1 Answers

One approach would be to have your web service host the helper app, and notify the other apps as necessary. This seems the most "chromium" way (whatever that means). But that would involve an app on one computer messaging an app on another computer, which seems complicated, at best.

You could also try "permissions": ["background"] (reference).

It appears extensions are allowed persistent background pages, whereas apps aren't. You could change your helper app into a helper extension that messages the other apps.

like image 134
Teepeemm Avatar answered Dec 09 '22 16:12

Teepeemm