Open gamesover opened 3 years ago
update:
putExtra
and getExtra
when broadcastingautoSend
method, so each time you call autoSend, you will register broadcast once. Thus, I move broadcasts out to initialize mthod.Anyone interests, you may refer my fork.
Hi @gamesover ! I'm trying to implement this listener in my project, but it don't show nothing. Can you gime me some help? Where can I put the listener, inside my sendSMS function or in a useEffect? My project sends a bulk of SMS, it works correctly but now I want to know which of them are received and which no. This is my sendSMS function:
const sendSMS = async () => { let increment = 0; const interval = 1000 * parseInt(timeInterval); setIsFinished(false); setIsSending(true); setLoadingText('Enviando...'); setIsLoading(true); var myLoop = setInterval(async function(){ await SmsAndroid.autoSend( globalContext.contacts[increment], message, (fail) => { console.log('Failed with this error: ' + fail); setErrorsCounter(errorsCounter => errorsCounter + 1); }, (success) => { setCounter(counter => counter + 1); //console.log('SMS sent successfully'); }, ); if (increment == globalContext.contacts.length-1) { clearInterval(myLoop); setIsLoading(false); setIsSending(false); setIsFinished(true); } increment++; },interval); };
Thanks!
Hi @antoniomefa . I have to change the source code of react-native-get-sms-android. When sending sms, I passed sms id. so when android broadcast sms sent/delivery status, it reports the result together with sms id. In this way, I know which sms is sent/delivered.
Detailed you may refer to my fork
Hi @gamesover , can you share the code :(
The above works, just it only returns message "SMS delivered" .
If multiple sms were sent out, how can I know which sms delivery is successful, and which is failed?
Also, I found a strange issue. 1st, I send a sms, callback trigger once, and output 1
SMS delivered
2nd, I send a sms, callback trigger twice, and output 2SMS delivered
... 10th, I send a sms, callback trigger 10th, and output 10SMS delivered