Ionic gets the contacts very slow


#1

When obtaining the contacts through the cordova-plugin-contacts plugin. When I run the script to get about 300 contacts is very delayed, lasts 8 seconds, someone knows a solution?

Ionic Info:
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 7.0.0 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.2
Node : v8.9.4
npm : 6.0.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro

getAllContactsFromPhoneBook() {
  return new Promise((resolve => {
    this.contacts.find(['id', 'name', 'phoneNumbers'], {multiple: true, hasPhoneNumber:true})
      .then((data: any) => {
        for (let i of data) {
          if (i.name.formatted) {
            if (i.phoneNumbers) {
              let name = i.name.formatted;
              this.contactsNames.push(
                name
              );
              let id = i.id;
              let phone = i.phoneNumbers;
              this.contactsArray.push({
                id: id,
                name: name,
                phone: phone
              });
            }
          }
        }
        this.contactsOrder = this.contactsNames;
        this.groupContacts(this.contactsOrder, this.groupedContacts).then(() => {
          this.groupedAllContacts = this.groupedContacts;
        });
        resolve(true);
      }, (err) => {
        console.log(err);
        resolve(false);
      });
  }));
}