0

I have built an android app that performs some downloads followed by some time consuming processing. My goal here is to do the downloading and the processing in the background. I have read about background and foreground services, but I am not able to understand them properly and which to use where.

I have built the rest of the app with ionic. Now I have to make the app work in background. I have tried cordova-plugin-background-mode available in ionic but unfortunately its not maintained anymore.

So what should I do to my app in android studio to make it support background processing. Also is it possible to combine android packages to an ionic project after building it?

Thanks in advance.

  • Does this answer your question? [Cordova scheduling task](https://stackoverflow.com/questions/31517871/cordova-scheduling-task) – Muhannad Fakhouri Dec 13 '21 at 06:45
  • @MuhannadFakhouri No I have tried that and the app stopped after some time. In case of my android studio SDK which was android 9 it ran for about 2500 seconds. Also in case of android 10/11 in mobile device, it ran for about 1500s – Sudharshan R Dec 13 '21 at 10:00
  • Did you have a look at this too https://ionicframework.com/docs/native/foreground-service ? – Muhannad Fakhouri Dec 13 '21 at 10:25
  • Just after you suggested, I tried it out. It seems to do the trick. but sometimes it just closes on its own. I just did a simple counter that increments every second by 1. sometimes it ran for hours and at other times it closed in leas than 20 minutes – Sudharshan R Dec 14 '21 at 04:50

0 Answers0