Send sms Silently in WP8 - c#

I was trying to send sms to a group of contacts via SmsComposeTask class.
But this class's Show() method only composes message in message app. I also want my code to send those texts automatically. Please help!!
Here is what i am using:
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = recipients; // recipients is the group of contacts
smsComposeTask.Body =
"Hello! This is a test sms message!";
smsComposeTask.Show();

See: http://social.msdn.microsoft.com/Forums/wpapps/en-us/85dc6ef5-98a9-4a17-a5f0-171372d8d9a3/how-to-send-sms-from-a-windows-phone-page
using Microsoft.Phone.Tasks;
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123"; smsComposeTask.Body = "Your SMS
text";
smsComposeTask.Show();
After that a dialog will be show asking the
user whether to send the message.
You cannot silently send an SMS
Also: https://developer.nokia.com/Community/Wiki/How_to_send_an_SMS_in_Windows_Phone
Note: In contrast to Symbian, Windows Phone does not allow you to send
sms "directly" or "silently" from your own app. As soon as sms sending
initiation code below is executed the native sms editor app will be
launched, giving the user the option to send the message or not.
I image this is done so that rouge apps can't send out a bunch of texts that will cost someone money.

Related

How to send whatsApp message to any number by using twilio using c#

I am new to Twilio
below is my code to send whatsapp message using C#
static void Main(string[] args)
{
// Find your Account Sid and Token at twilio.com/console
TwilioClient.Init(Model.AccountSid, Model.AuthToken);
var message = MessageResource.Create(
//whatsapp message
to: new PhoneNumber(Model.To), from: new PhoneNumber(Model.From),
body: "Ahoy from Twilio!!!!!"
);
Console.WriteLine("Message SID: " + message.Sid);
}
Model.To have my whatsapp number which I have used while registering with twilio.
Model.From have Twilio's WhatsApp number
if I run this console application then I get message on my whatsapp number
but when I try to send message to my friend's WhatsApp number by assigning that number to Model.To,
I am not getting message on that number
How can I achieve it?
is there any other way to achieve it without twilio?
Thanks in advance.
Did you check the Twilio Debugger for errors. If you are sending the first message from Twilio out to the WhatsApp user, you must initially use a Template, as detailed here.
If you are using the Trial account then
1)first verify that number from here https://www.twilio.com/console/phone-numbers/verified
2)after verifying the number ,send whatsapp message from verified number to the twilio's whatsapp number using your sandbox code (code will be like e.g join XYZ-PQR)
3)after sending the whatsapp message that number will join your sandbox and you will be able to send message on that number

Use SmsManager to open the default sms app

I am building a Xamarin Android application (API version>=23) that should call the SMS default application with a prefilled-in number and prefilled-in text.
I figure out how to send the SMS using SmsManager
SmsManager.Default.SendTextMessage("Number", null, "Text", null, null);
The above line send the SMS text directly after the user grants the permission to the app. Is there a way to open the default SMS app instead with prefilled in destination number and text, and let the user press send ?
Any help would be appreciated.
Setting up an Intent can bring up the default SMS massager app:
var intent = new Intent(Intent.ActionSendto);
intent.SetData(Android.Net.Uri.Parse("smsto:" + "555-555-1212"));
intent.PutExtra("sms_body", "StackOverflow rocks");
StartActivity(intent);
It is doubtful that there is no SMS registered app, but you can use the Intent that you populated to check for for which app/activity will launched:
var packagename = intent.ResolveActivity(PackageManager)?.PackageName;

How to Send SMS on Xamarin.Forms

I am developing Xamarin.Forms project, iOS, Android and Windows Phone.
My app ask the user to enter text Message and Phone number then on submit, I need to send SMS to the phone number.
I prefer to have a single implementation for all platforms.
You can use this open source plugin Xam.Plugins.Messaging
https://github.com/cjlotz/Xamarin.Plugins
This is the provided example (from https://github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/Details.md ) :
// Make Phone Call
var phoneDialer = CrossMessaging.Current.PhoneDialer;
if (phoneDialer.CanMakePhoneCall)
phoneDialer.MakePhoneCall("+272193343499");
// Send Sms
var smsMessenger = CrossMessaging.Current.SmsMessenger;
if (smsMessenger.CanSendSms)
smsMessenger.SendSms("+27213894839493", "Well hello there from Xam.Messaging.Plugin");
var emailMessenger = CrossMessaging.Current.EmailMessenger;
if (emailMessenger.CanSendEmail)
{
// Send simple e-mail to single receiver without attachments, bcc, cc etc.
emailMessenger.SendEmail("to.plugins#xamarin.com", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin");
// Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc.
var email = new EmailMessageBuilder()
.To("to.plugins#xamarin.com")
.Cc("cc.plugins#xamarin.com")
.Bcc(new[] { "bcc1.plugins#xamarin.com", "bcc2.plugins#xamarin.com" })
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.Build();
emailMessenger.SendEmail(email);
}
Microsoft now has this feature in their new all-encompasing https://learn.microsoft.com/en-us/xamarin/essentials NuGet package.

How to send email with C# on Windows Phone 8 with from field

As I tried to explain in the title, I need to send emails in my WP8 app from my own account not by the existing accounts on the phone. I plan to use this for password reset process. What I currently use is:
private void Button_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "AMailAdress";
emailcomposer.Subject = "subject from test app";
emailcomposer.Body = "This is a test mail from Email Composer";
emailcomposer.Show();
}
This just sends via user's accounts. Shortly, I need a way to set from field sending an email. Any help is appreciated.
You should better send email from the server, not from windows phone app.
If it doesn't need user's account then there is no reason for the email to be created from the phone.
Maybe you can POST to an URL with required info, and make the server (your service) send the email.

Sending SMS with delivery message

How can i write code for send SMS with delivery message in Windows Mobile? please guide me with C# or C++ code.
I want to use SmsSendMessage API in this code because this API have more features.
You could use SmsSendMessage to send the message and use SmsGetMessageStatus to get the status report of the sent SMS. This is all C++ code, but you can pinvoke it as well.
Microsoft.WindowsMobile.PocketOutlook Namespace
The Microsoft.WindowsMobile.PocketOutlook namespace provides classes that allow you to create and access PIM data items (Appointments, Tasks, and Contacts), and MAPI messaging items (e-mail and SMS messages), on mobile devices
SmsMessage Class in msdn
This sample shows how to send an SMS message to a mobile phone.
public void SmsMessageSend()
{
SmsMessage smsMessage = new SmsMessage();
//Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?";
smsMessage.To.Add(new Recipient("John Doe", "2065550199"));
smsMessage.RequestDeliveryReport = true;
//Send the SMS message.
smsMessage.Send();
return;
}

Categories