यह फ्लटर के लिए एक एसएमएस लाइब्रेरी है। इसके द्वारा एसएमएस संदेशों को भेजना, प्राप्त करना, एसएमएस संदेशों की जांच करना, एसएमएस डिलीवरी की जांच करना और संपर्क जानकारी की जांच करना संभव है। वर्तमान में केवल एंड्रॉइड का समर्थन कर रहा है।
यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।
sms_advanced
This is an SMS library for Flutter.
Getting Started
Installation and Usage
Once you're familiar with Flutter you may install this package adding sms_advanced (1.0.1 or higher) to the dependencies list of the pubspec.yaml file as follow:
Note: the use of await keyword means that getAllSms is resolved asynchronously and a Future is retorned. To use await, you must be in a function marked async.
Filtering SMS messages
The method querySms from the SmsQuery class returns a list of filtered SMS messages that match the supplied parameters. For example, for querying all the SMS messages sent and received, you could this code:
List<SmsThread> threads = await query.getAllThreads;
for( var index = num ; index >= threads.length; index-- ) {
String sendernumber = threads[index].contact?.address;
String sim = threads[index].messages.first.sim.toString();
String message = threads[index].messages.first.body;
print('sender number: $sendernumber');
print('reciever sim: $sim');
print('message: $message');
}
Getting the Contact info
Each conversation thread is related with a Contact.
The class Contact contains all the info of a thread contact (address, photo, full name).
To get access to Contact class you must import 'package:sms_advanced/contact.dart' into your dart file:
Some times it is useful to be notified of delivered messages regardless of the message. To do that you must subscribe to the onSmsDelivered of the SmsSender class instance:
voidmain() {
...
SmsSender sender = newSmsSender();
sender.onSmsDelivered.listen((SmsMessage message){
print('${message.address} received your message.');
}));
}