andreyvital / react-native-android-sms-listener

Allows you to listen for incoming SMS messages using React Native
MIT License
358 stars 99 forks source link

Not listening #19

Closed nazarTrynko closed 7 years ago

nazarTrynko commented 7 years ago

Hi! I have added everything like in guide, added listener to my view, but it does not enter listener's callback

andreyvital commented 7 years ago

Can you share a code snippet of how you're using it?

nazarTrynko commented 7 years ago

I tried to put it in componentDid/WillMount componentDidMount() { SmsListener.addListener(message => { console.log(message) }) }

and before component:

import SmsListener from 'react-native-android-sms-listener

SmsListener.addListener(message => {
  console.log(message)
})

export default class SmsView extends Component {
andreyvital commented 7 years ago

Right. I'll try to troubleshoot/reproduce this later.

nazarTrynko commented 7 years ago

Thanks! Looking forward to hearing from you!

julianocomg commented 7 years ago

@nazarTrynko What's your RN version?

nazarTrynko commented 7 years ago

@julianocomg 0.43

julianocomg commented 7 years ago

@nazarTrynko I've tested with 0.44.1 with no problems (but the API of these two versions is the same). Please, remove the module from your project, including via npm, and execute the following commands:

Try again, and give us a feedback

nazarTrynko commented 7 years ago

@julianocomg thank you for response. I tried your approach, but unfortunately it didn't help =(

nazarTrynko commented 7 years ago

image

I also see that EmitterSubscription does not have context and _currentSubscription. Maybe something about those is wrong

ghost commented 7 years ago

Hi nazarTrynko,

After include everything like in guide, have you sent an SMS through telnet protocol? When a SMS arrives to your phone then the listener acts and you can see your console.log

nazarTrynko commented 7 years ago

@lmmaeso Hi, well, I used sms simulation from AVD emulator extended control and also tried it with real sms on my device

nazarTrynko commented 7 years ago

Okay, so the solution was just to add permission for sms for application in Settings => Apps. Cheers =)

andreyvital commented 7 years ago

🍻