UI not Updating

#1

I am trying to Implement the OTP verification for my app.

Below code I am using, I am able to receive the sms from Phone, But I am not able to update on my UI.

document.addEventListener(‘onSMSArrive’, function (e) {
var sms = e.data;
alert(“sms recevided…”);
alert("received sms " + JSON.stringify(sms));
if (sms.address == ‘AX2345’) //look for your message address
{
this.otp = sms.body;
this.newOtp = parseInt(this.otp);
console.log("new otp ", this.newOtp);
if (SMS) SMS.stopWatch(function () {
console.log(‘watching stopped’);
}, function () {
console.log(‘failed to stop watching’);
});

  }