1

I am new in Ionic. I am using cordova-sms-plugin. Whenever I call this plugin I get message

W/PluginManager: THREAD WARNING: exec() call to SMS.listSMS blocked the main thread for 34ms. Plugin should use CordovaInterface.getThreadPool().

As an example my code look like this:

  this.platform.ready().then((readySource) => {
  let filter = {
    box: 'inbox', // 'inbox' (default), 'sent', 'draft', '' for all
    indexFrom: 0, // start from index 0
    maxCount: 3, // count of SMS to return each time
  };

  if (SMS) SMS.listSMS(filter, (ListSms) => {
  let messages = ListSms;
  console.log(messages);
    ,
    Error => {
      alert(JSON.stringify(Error))
    });
});

My assumption was that if this.platform().ready() then it handles threads on it is own, however it was naive. Is there a way to manage threads to avoid blocking of the main Thread?

Another issue is that after few sms checks, my app freezes.

Bahodir
  • 539
  • 1
  • 9
  • 29
  • 1
    The problem is the plugin itself, not your fault, so you can only fix it by changing the plugin code as explained on https://stackoverflow.com/questions/22382260/how-to-run-cordova-plugins-in-the-background/22400699#22400699 – jcesarmobile Oct 07 '18 at 22:23
  • @jcesarmobile thank you for heads up, after few tries it is kind of working. – Bahodir Oct 08 '18 at 15:07

0 Answers0