You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mohemm_srca/Mohem/src/assets/js/sms.js

28 lines
783 B
JavaScript

var SMS = function () {
this.isSupported = function () {
return SMSReceive != null;
}
this.startReciever = function (success, failure) {
SMSReceive.startWatch(function() {
console.log('smsreceive: watching started');
document.addEventListener('onSMSArrive', function(e) {
console.log('onSMSArrive()');
var IncomingSMS = e.data;
success(IncomingSMS.body , IncomingSMS.address);
});
},
function() {});
}
this.stopReciever = function () {
SMSReceive.stopWatch(function() {
console.log('smsreceive: watching stopped');
}, function() {
console.log('smsreceive: failed to stop watching');
});
}
}