I am developing sms reading app using the flutter telephony package. Everything is working fine, but there is a problem when the mobile has two sim cards. I am unable to track which sim card is receiving SMS. Can anyone help me to achieve my goal?
Here is code
onMessage(SmsMessage message) async {
print('sid: ${message.subscriptionId}');
ToasterShow('sub= ${message.subject}');
String? operatorName = await telephony.simOperatorName;
}
here subscriptionId return null.
Hope anyone help me.
Thanks
Related
I need a callback URL so that when a mobile money API completes a payment transaction, my app can receive a message about the transaction status. I'm building a flutter app. I have seen that cloud functions may be the answer. So, I need help on how to get started on creating this callback URL.
I'm yet to try anything because all the material I have seen talks about JavaScript and websites. I need material on doing this in the flutter mobile app.
look at this snippet I hope it helps
// await for your first function t
await moneyFuntion()
.whenComplete(() async => await anotherAPIFuntion())
.onError((error, stackTrace) {
log("$error");
How can I send for example SMS code verification in Flutter (without Firebase Auth because I have MySQL database with PHP connection).
I have tried :
Future<void> _sendCode(String phoneNumber) async
{
phoneNumber = "XX XX XX XX XX";
String code = _createCode();
String message = "The code is $code";
String uri = 'sms:$phoneNumber?body=$message';
await launchUrlString(uri);
}
And many other things, but it open messaging on my device. I want the code to be sent automatically.
I have tried to find out how to send a message from PHP but without satisfactory result.
You can try flutter_otp package I think it's the best option,
You can visit https://pub.dev/packages/flutter_otp for more info,
You can also use url_launcher package.
I am creating a web app in flutter. It is used for entering students' attendance into the database.
What I want to achieve is to send SMS to the parents of absent students. I came upon flutter_sms 2.3.1 and it is supported for Android, iOS and web as per the pub.dev docs but I could not find any reference about sending SMS in flutter web using the same package. Please let me know if there is any way to achieve this task that I want.
Following is the code for sending the SMS but not working in Flutter web.
void _sendSMS(String message, List<String> recipents) async {
String _result = await sendSMS(message: message, recipients: recipents)
.catchError((onError) {
print(onError);
});
print(_result);
}
Twilio API would totally help you sending sms/whatsapp messages from any plaform automatically
I have an app that was using firebase messaging 7.0.3 and all worked perfectly. But when I migrated to firebase messaging 9.0.0, the push notifications are not being handled.
I know that the app is correctly linked to firebase and cloud messaging because in background I see the push notification comming, the problem is when I click that notification the app don't handle this event. Also, when the app is in foreground, the event of receiving the notification is not being triggered.
Specifically, the functions FirebaseMessaging.onMessage and FirebaseMessaging.onMessageOpenedApp are not working. My code is:
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print("notification: message");
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
print("notification: resume");
});
The prints are never called, and if I put some more code inside isn't executed too.
I also call FirebaseMessaging.getToken and I can get the token, plus when the app is in background I get the push notification, so is not a link problem with firebase. In the logs, when I receive the push I can see a message saying: Broadcast received for message. So I assumed that the push is arriving in all the occasions, and I am doing something wrong in the code.
I tested all cases in Android and iOS physical devices.
Someone know why this occurs?
I came across this exact same issue after migrating and upgrading to 9.0.0.
There is a minor issue with 9.0.0 plugin.
The fix can be found here:
https://github.com/FirebaseExtended/flutterfire/issues/4949
To cut a long story short, if you navigate to the definition of the factory
RemoteMessage.fromMap() Using Cmd+Click or Ctrl+Click while hovering over the RemoteMessage class with the mouse), in the return statement, change contentAvailable: map['contentAvailable'], to contentAvailable: map['contentAvailable']??false.
Notifications are now working for me again now.
This should work for you until the plugin is fixed.
I've set up AdMob ads on my app and want to set up In-App Purchases so that people can pay to disable the ads if they want to. I looked around for some guides on how to do it but they are all for Consumables, none for Non-Consumables. Even the example code that comes with the in_app_purchase Flutter package is only about Consumables.
Can someone give me some guidance on how to set up the minimal code just to disable ads in Flutter? I managed to set it up a couple of years back in React Native for consumables and even with guides I remember it was a bit of a nightmare.
I have the In-App Purchase set up in Appstoreconnect already, I just want to know what the actual code needed is. I'm assuming that with just disabling ads the code would be shorter than with consumables.
In the in_app_purchase readme it gives this:
final ProductDetails productDetails = ... // Saved earlier from queryPastPurchases().
final PurchaseParam purchaseParam = PurchaseParam(productDetails: productDetails);
if (_isConsumable(productDetails)) {
InAppPurchaseConnection.instance.buyConsumable(purchaseParam: purchaseParam);
} else {
InAppPurchaseConnection.instance.buyNonConsumable(purchaseParam: purchaseParam);
}