Closed bugger279 closed 2 years ago
@bugger279 Are you using the same hash for Prod and Staging App? If you are creating the app hash with signed APK then the hash should be different.
This should help you: #22
No, I'm not testing in signed apk. I'm testing the app in the emulator and then the mobile device. It's working the way it's expected in the emulator and not in the mobile. While testing the app I also logged the hash key which is the same for both in the emulator and in the mobile devices. Is it because of the FCM plugin or conflict in the plugins?
And make sure you are calling the listener method to watch sms
@bugger279 I don't think there is conflict with other plugins. You can try to get the hash code from your mobile device by calling plugin method. getAppHashCode and then send the SMS with new hash code
if (this.platform.ready()) { const smsRetriever: any = window.cordova.plugins.smsRetriever; smsRetriever['getAppHash']((res) => { this.cd.detectChanges(); console.log(res); }, (err) => { console.warn(err); }); }
Written this to get the app hash
watchForSMS() { if (this.platform.ready()) { const smsRetriever: any = window.cordova.plugins.smsRetriever; smsRetriever['startWatching']((res) => { console.log(res); let smsTextmessage = res.Message.toString().substr(4, 6); console.log(smsTextmessage); this.cd.detectChanges(); }, (err) => { console.log(err); }); } }
And this to watch for SMS. watchForSMS() function is triggered when the user clicks on the button to call API and receive an SMS. Somehow this entire scenario is working when I send SMS using the emulator phone dialogue box, it watches for SMS, and then it shows data (the message) at the breakpoints I added while debugging. When I repeat the same thing on a mobile device it skips the promise block and it shows no error in the error block, which is quite confusing.
From where are you sending the SMS to your mobile device?
the SMS text format should be like:
<#> Your ExampleApp code is: 389573 DLigSXow4De
There's a service running on the backend side (Twilio) that sends SMS in this specific format to mobile device
<#> Your ExampleApp code is 389573 DLigSXow4De
@bugger279 You can try to run this demo ionic 5 app on your machine and install the APK on your mobile and check. whether it is working in your device or not - https://github.com/hanatharesh2712/sms-plugin-test-ionic-5
I tried it and it's working fine and not in the app on which I'm trying to integrate (say it have more than 30 plugins).
@hanatharesh2712 can you reopen this issue to discuss this and also if you can get in a call with me we can have a clear vision about the issue if something is not clear from the comments?
Hi, Pay $$ to develop ionic caption to read messages from INBOX
@bugger279 you can debug the code using Android studio and will have better idea what is happening
@bugger279 how did you resolved the issues and what was causing issues? Please write here so others can get the idea when they have such issues
Hi, sorry for the delayed response and yes I was able to resolve it.
The app which I was working on was already on the playstore so it was not working on mobile devices.
The theory is that if the application is already on the play store then we will not be able to read the message even if you're testing it on an unsigned apk. So we have to build the signed apk and test it and it will work properly. But somehow I'm not able to understand why it is working on an emulator and not on a mobile device (for unsigned apk).
I'm able to read message while running the app in the emulator, but when I run the app on the mobile it's not able to read message. Is there any reason why?
Thanks in Advance.