| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
ekxh8810
9年前发布

Listen for incoming SMS messages in React Native!

来自: https://github.com/CentaurWarchief/react-native-android-sms-listener

react-native-android-sms-listener

An utility that allows you to add listeners for incoming SMS messages.

Example

import SmsListener from 'react-native-android-sms-listener'    SmsListener.addListener(message => {    console.info(message)  })

The contents of message object will be:

{    originatingAddress: string,    body: string  }

Installation

$ npm install --save react-native-android-sms-listener

...and all you need to do to use this so-called utility is:

android/settings.gradle

include ':ReactNativeAndroidSmsListener'    project(':ReactNativeAndroidSmsListener').projectDir = new File(    rootProject.projectDir,    '../node_modules/react-native-android-sms-listener/android'  )

android/app/build.gradle

dependencies {    compile project(':ReactNativeAndroidSmsListener')    // (...)  }
import com.centaurwarchief.smslistener.SmsListener;    @Override  protected List<ReactPackage> getPackages() {    return Arrays.<ReactPackage>asList(      new MainReactPackage(),      new SmsListener(this)      // (...)    );  }

 本文由用户 ekxh8810 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1455062491855.html
React 安卓开发 JavaScript开发