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');
        });
    }

}