In continuation with the previous blog, we would continue to build our new basic SMS app using Flutter. In this blog, we would see how we can add the functionality of listening for incoming SMS messages on the device.
We are using the sms
package for building this app. Please check out the previous blog to get the brief intro on how to use this package.
SmsReceiver receiver = new SmsReceiver();
Now we need to use the receiver
we created above to bind a listener for the SMS message received event. We use the .listen
method on the onSmsReceived
event of the receiver which excepts a callback and gives us the received message object as an argument whenever a new message is received by the device.
receiver.onSmsReceived.listen((SmsMessage msg) =>
#Do something
);
SMSMessage
, contains sender, message and date of the SMS message. Internal implementation of SMSMessage
class is given below:
class SMSMessage {
String message;
String sender;
var date;
}
Now you can start a message listener like shown above, and detect all the incoming SMS messages on the user's phone.
In the next blog, we will set up a mailer, which will be used to email the incoming SMS message to a particular email.
Gartner estimates that by 2020, chatbots will be handling 85 percent of customer-service interactions; they are already handling about 30 percent of transactions now.
View ArticleIn this blog, we will see how we can send emails from our flutter application using mailgun credentials. This post is in continuation of the Flutter SMS app series.
View ArticleIn continuation with the previous blog, we would continue to build our new basic SMS app using Flutter. In this blog, we would see how we can add the functionality of listening for incoming SMS messages on the device.
View Article