As far as I know, to send SMS to contacts stored in TinyDB, you’ll need to use the ‘SendTextMessage’ block from the ‘Texting’ component in Kodular. I’d suggest to make sure you retrieve the list of contacts from TinyDB, then loop through each contact and use the ‘SendTextMessage’ block to send the SMS.
If permissions or API limitations are an issue, consider using an external service API that allows sending SMS in bulk.
Alright, no problem. First, ensure that you’ve correctly retrieved the list of contacts from TinyDB. Then, in Kodular, use a loop structure like ‘for each item in list’ to iterate over each contact.
Use a ‘for each item in list’ block, where the list is your contacts from TinyDB. Then, inside the loop, use the ‘SendTextMessage’ block from the ‘Texting’ component. Set the phone number to the current item in the loop (each contact’s number) and specify your message.
ALSO, if you hit any roadblocks, like permissions or the number of SMS you can send, an external SMS service API might be a good alternative. These services usually allow bulk SMS and handle permissions for you. Twilio is a popular choice, but there are many others out there.
The app still crashes and i followed on how the loop goes and someone aid me on this? Please i need this for my College project. I have also linked the project file here. Test_Features2.aia (280.9 KB)
The only thing I can think about is that there might be an issue in the blocks you’ve assembled. Would you mind double-checking the part where you’re retrieving the contact numbers from TinyDB? Make sure that each number is correctly formatted and that the list isn’t empty.
Also, inspect your loop and the ‘SendTextMessage’ block for any mismatches in variable names or types.
Sometimes, the app might crash if it’s trying to send an SMS to an invalid number or if the loop encounters a non-number entry. If everything seems in order, could you check the logs to see what error is causing the crash?
it looks like you have overseen my previous answer…
this solution will overwhelm the texting component and your device…
but it will be a good learning experience to try it…
and after this, you then might want to use a clock component to avoid sending the sms all at exactly the same time, see also The ‘Do something’ example
Hi, im really lost on this,i have provided here my current update, i tried multiple things but the app still crashes. Can someone give an idea on why the app crashes. i know it’s the mass sms sending feature is the main cause but i need some idea on how to go through. Please, i started this like last week and trying to learn
If you are asking for help, I recommend you to make it as easy for others to be able to help you …
You probably will get more feedback then…
which means in your case post a screenshot of your relevant blocks…
To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc… this takes time, and most people will not do that…
Thank you.
I understand im sorry for bugging you all. let me take a screenshot and send here below. Please keep in mind that in database there is only one contact. It is not even send one message. I’m setting 3 max contacts to send sms. So i think the clock function wont be necessary. If it does can you show how to build the blocks overall?
Remove the for each in list loop and start the clock instead
Inside the timer event check, if there are still items in your list
If yes, select the first phone number from the list, send the message and delete the first item from the list
If not, stop the clock
The app crashes, i put a contengency if the phone number is not retrieving the base number should be a random but the app crashes instantly with no execution.Is there a mistake im making here?
There is no counter required, there is no max varíable required, you only need a list… and my assumption was your global variable contact_phone_number is a list, because you are using it in that loop…