Ionic 2 SMS plugin

Hi,

I follow the steps in http://pointdeveloper.com/read-sms-list-with-ionic-2/ but i got error Property ‘SMS’ does not exist on type ‘Window’. How can i handle this.

  getSMS(){
      if(window.SMS) window.SMS.listSMS({},data=>{
          setTimeout(()=>{
              console.log(data);
              this.smses=data;
          },0)

      },error=>{
        console.log(error);
      });
    }

Thank you in advance.

You should use the ionic-native plugin: https://ionicframework.com/docs/native/sms/

Hi LoLStats

Yes I already imported that plugin.

Thank for your reply.

But your code does not look like you are using the ionic-native/SMS plugin.
The linked guide you posted is really old and outdated.

Hi lolstats

I’m newbie in ionic 2 . I read the documentation of SMS in https://ionicframework.com/docs/native/sms/ but I cant find any usage how to read all SMS. Thank you

First declare var SMS:any on the top of page. Following this complete guild to integrate it with your Ionic Project working in Android with ionic 3 http://www.programmingworldtech.com/2017/09/ionic-3-cordova-read-sms-plugin.html