Comments (12)
Hello,
You can't do that for now, we are working on it, sorry
from flutter_sms.
from flutter_sms.
@nitneuq33000 We have implemented the feature, you can test it like that:
SmsSender sender = new SmsSender();
String address = getAddress();
...
SmsMessage message = new SmsMessage(address, 'Hello flutter!');
message.addStateListener((state) {
if (state == SmsMessageState.Sent) {
print("SMS is sent!");
} else if (state == SmsMessageState.Delivered) {
print("SMS is delivered!");
}
});
sender.sendSms(message);
from flutter_sms.
@babariviere I tried, I upload pubspec.yaml
I have an error with getAdress () (no defined methode ) so I change the code like this
SmsSender sender = new SmsSender();
...
SmsMessage message = new SmsMessage(+33---------, 'Hello flutter!');
message.addStateListener((state) {
if (state == SmsMessageState.Sent) {
print("SMS is sent!");
} else if (state == SmsMessageState.Delivered) {
print("SMS is delivered!");
}
});
sender.sendSms(message);
I have this error message:
compiler message: lib/SecondPage.dart:181:38: Error: Getter not found: 'SmsMessageState'.
compiler message: if (state == SmsMessageState.Sent) {
compiler message: ^^^^^^^^^^^^^^^
compiler message: lib/SecondPage.dart:183:45: Error: Getter not found: 'SmsMessageState'.
compiler message: } else if (state == SmsMessageState.Delivered) {
compiler message: ^^^^^^^^^^^^^^^
compiler message: lib/SecondPage.dart:180:31: Error: The method 'addStateListener' isn't defined for the class 'sms::SmsMessage'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'addStateListener'.
compiler message: message.addStateListener((state) {
compiler message: ^
compiler message: lib/SecondPage.dart:181:38: Error: The getter 'SmsMessageState' isn't defined for the class '#lib1::_MyAppState'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'SmsMessageState'.
compiler message: if (state == SmsMessageState.Sent) {
compiler message: ^
compiler message: lib/SecondPage.dart:183:45: Error: The getter 'SmsMessageState' isn't defined for the class '#lib1::_MyAppState'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'SmsMessageState'.
compiler message: } else if (state == SmsMessageState.Delivered) {
compiler message:
from flutter_sms.
getAddress() is not in the library, you have to put your own address
from flutter_sms.
It's a string so you have to put it between "
from flutter_sms.
sorry I'm a noob ^^ I tried to put my number +336------- everywhere
String address = ("+336------");
String address = "+336------";
String address = "06--------";
...
and I have all the time this error
compiler message: lib/SecondPage.dart:181:38: Error: Getter not found: 'SmsMessageState'.
compiler message: if (state == SmsMessageState.Sent) {
compiler message: ^^^^^^^^^^^^^^^
compiler message: lib/SecondPage.dart:183:45: Error: Getter not found: 'SmsMessageState'.
compiler message: } else if (state == SmsMessageState.Delivered) {
compiler message: ^^^^^^^^^^^^^^^
compiler message: lib/SecondPage.dart:180:31: Error: The method 'addStateListener' isn't defined for the class 'sms::SmsMessage'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'addStateListener'.
compiler message: message.addStateListener((state) {
compiler message: ^
compiler message: lib/SecondPage.dart:181:38: Error: The getter 'SmsMessageState' isn't defined for the class '#lib1::_MyAppState'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'SmsMessageState'.
compiler message: if (state == SmsMessageState.Sent) {
compiler message: ^
compiler message: lib/SecondPage.dart:183:45: Error: The getter 'SmsMessageState' isn't defined for the class '#lib1::_MyAppState'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'SmsMessageState'.
compiler message: } else if (state == SmsMessageState.Delivered) {
compiler message:
if you have a simple example where I can put my number, it will be perfect :) sorry for my bad level
here is my configuration
[β] Flutter (Channel beta, v0.2.8, on Microsoft Windows [version 10.0.16299.309], locale fr-FR)
[β] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[β] Android Studio (version 3.0)
[β] VS Code, 64-bit edition (version 1.21.1)
[β] Connected devices (1 available)
β’ No issues found!
I tried to add : " Function(SmsMessageState) addStateListener;" in sms.dart pluggin but I y always error: line 181 pos 31: lib/SecondPage.dart:181:31: Error: The method 'addStateListener' isn't defined for the class 'sms::SmsMessage'.
from flutter_sms.
@nitneuq33
Did you update to the latest package version (0.1.0) in your pubspec.yaml file?
flutter:
sdk: flutter
sms: ^0.1.0
from flutter_sms.
from flutter_sms.
I think you have to run flutter update or something like that to update all dependencies
from flutter_sms.
It's ok after flutter upgrade :) thank you. I tried a simple code and yes it's print my SMS after received. but now I want to treat the received message. how to extract le string message ? I tried to create a variable like var X = msg; or string X = msg; but msg isn't defined. I also tried to use _smsSubscription = _receiver.onSmsReceived.listen((SmsMessage msg) => _lastMessage = msg) but _lastMessage return :"instance of 'SMSMessage'. thank you for all
from flutter_sms.
You can use message.body π
from flutter_sms.
Related Issues (20)
- What about dual sim android if I want to send message from selected sim... HOT 5
- logo design contribution HOT 16
- Contact lookup appears to be failing (maybe just on M+?) HOT 3
- Error when trying to send message with no money on account HOT 4
- Send SMS Permisson Error HOT 10
- Complete rewrite in Kotlin HOT 4
- toString is not getting called on error objects present in print statement HOT 3
- Can this library create arbitrary SMS messages? HOT 35
- Update for Dart 2. HOT 1
- "Sent" messages are not being saved to phone when written directly [feature/smsdb] HOT 6
- We need integration tests
- Potential compatibility issues. HOT 6
- SMS deletion HOT 15
- Cannot send using 2nd sim slot HOT 6
- How to determine if message failed in sending? HOT 4
- First access error HOT 1
- Seems to conflict with flutter_simple_permissions HOT 8
- Need update the plugin to dart sdk 2.1 HOT 5
- SMS is sent but it's not stored in the Database HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_sms.