How to start second thread in ionic

how we can start second process in ionic because i want to start some calculation in background without effecting user interface tread

Something like…

   doSomething(){
      return new Promise((resolve, reject) {
         //pretend a long-running task
         setTimeout(() => { resolve(true); }, 5000);
      });
   }

Then call from your code

    this.doSomething().then(truthy => { console.log('finished'); });

please follow attached link , i want implement same https://forum.ionicframework.com/t/unable-to-provide-geolocation-when-app-in-background-mode/136272

I used this plugin in the past…

It does have a cost - but works!

This looks promising

I think when you say background you mean when the app is closed or hidden…

Refer to my previous two posts.

NO I want to run two separate thread

The thing you are looking for is web worker which runs on separate thread in background without affecting the main thread ui.

1 Like