No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
analysis.js
index.js
package.json
smsreceiver-Android.js

README.md

SmsReceiver Extension from Smartface

This extension work only Android. (Emulator & Player version 6.6.1 and upper.)

Twitter: @Smartface_io License

SmsReceiver

This extension is reading incoming sms content.

Installation

Smartface SmsReceiver can be installed via npm easily from our public npm repository. The installation is pretty easy via Smartface Cloud IDE.

  • Run command (cd ~/workspace/scripts && npm i -S sf-extension-smsreceiver)

Open this line in config/Android/AndroidManifest.xml file.

<!-- Required for receive sms. -->
<uses-permission android:name="android.permission.RECEIVE_SMS" />

You must request permission for sms receive. (API LEVEL 23 AND UPPER)

Application.android.requestPermissions(1002, Application.Android.Permissions.RECEIVE_SMS);

How to use

const Page = require("sf-core/ui/page");
const Page = require("sf-core/ui/page");
const extend = require("js-base/core/extend");

var Page1 = extend(Page)(
    function(_super) {
        _super(this, {
            onShow: function(params) {
                this.statusBar.visible = true;
                this.headerBar.visible = true;

                const Application = require("sf-core/application");
                const SmsReceiver = require('sf-extension-smsreceiver');

                Application.android.requestPermissions(1002, Application.Android.Permissions.RECEIVE_SMS);
                Application.android.onRequestPermissionsResult = function(e) {
                    if (e.requestCode === 1002 && e.result === true) {
                        console.log('registerReceiver');
                        SmsReceiver.registerReceiver();
                        SmsReceiver.callback = smsCallback;

                    }
                };

                // SmsReceiver.unRegisterReceiever();

                function smsCallback(e)
                {
                    console.log(e.senderNumber + " : " + e.smsBody);
                }
            }
        });

    }
);
module.exports = Page1;

License

This project is licensed under the terms of the MIT license. See the LICENSE file. Within the scope of this license, all modifications to the source code, regardless of the fact that it is used commercially or not, shall be committed as a contribution back to this repository.