How to start an app after devices boot or restart with native events?

I need my app working in backgound mode, starting after devices boot and restarting/reactivating with devices native events fired (in case when the android process limitation has killed it).

Considering that i’m using ionic2, how is the right way to achieve this behavior?

I haven’t found an alternative at ionic docs.

Do you know any native app that has this functionality?

Gmail, WhatsApp and Youtube apps are ready to use (and receive messages/updates) since the cellphone startup. We don’t need to open them directly to work.

I want to reproduce this behavior in my app, but to monitor the device location/movement.

These all use push notifications to receive updates (app starts only after you select one of them) or are integrated into the OS and have special rights.

@Sujan12 that’s right, but even so in some devices the app couldn’t receive any push notification because the app has ‘auto-start’ blocked.

@Sujan12, “…are integrated into the OS and have special rights” would be something like “installed as a service with permission to access GPS”, for example?

@lbrgeorge, when the app has “auto-start” blocked, the only way to start it is with user interaction or we could register it to be notified with some devices native event (devices movement, in my case)?

Thanks in advance!

Huh what? Push notifications are received by the OS and handled there, only if you “click” one it gets handed to your app to be handled there (optionally).

If there is a way for an app to run as a “service”, then yes. But a normal app has to be started by user interaction.

Yes, It does. But it need to register the token and then receive the notifications but somehow (at least in some devices) when app get closed it stops receiving any notification. I suppose it unregister the token. I’ve not investigated it yet. So with ‘auto-start’ the app register the token anytime when needed.

The devices which I tested are:
Asus Zenfone 3
Lenovo Vibe K5

How do i call BootReceiverService like android in Ionic3/4.