dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.96k stars 1.7k forks source link

Send SMS without opening default messaging app #18375

Open mammadkoma opened 10 months ago

mammadkoma commented 10 months ago

Description

I would like to send SMS by C# code without opening default messaging app.

Public API Changes

ISms

Intended Use-Case

Sending SMS in backgroud in single mode and multi sms with try catch and get count of sending

mattleibow commented 10 months ago

I do not believe this is possible on iOS and I think for Android you have to mark the app as a default SMS app.

For this it may be better to use a SMS service and use their REST APIs to send messages.

ghost commented 10 months ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

mammadkoma commented 10 months ago

I did it in flutter and sms sent correctly on android phone : https://mwaseemaw.medium.com/flutter-send-sms-in-the-background-489672d139f8

mattleibow commented 10 months ago

That is just Android I think? This is the issue, only android supports it.

jozif001 commented 1 month ago

yes it can be done only on Android, and you need to specify the right permission. we have been using this plugin for Xamarin: https://github.com/cjlotz/Xamarin.Plugins https://github.com/cjlotz/Xamarin.Plugins/blob/327386dc20e502e6e75503d0dcd7eddb6b4e8be3/Messaging/Plugin.Messaging.Abstractions/ISmsTask.cs#L46

and it works fine, but now with .NET Maui we don't have an alternative.