Forum Cross Platform with Xamarin

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Send an SmS in Xamarin forms

Dear Techie,
I want to send an SMS using TextLocal.in. I want to get an Text from Front end and add an text to it. and Button to send an SMS.
How i will achieve this ?

Guide me

Best Answer

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited December 2020 Accepted Answer

    I want to get an Text from Front end and add an text to it. and Button to send an SMS.

    To get and modify the text of the front end, you could call the corresponding api methods.

    To send an SMS with 'TextLocal.in', you could try the following code:

    public string sendSMS()
    {
        String message = HttpUtility.UrlEncode("This is your message");
        using (var wb = new WebClient())
        {
            byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
                    {
                    {"apikey" , "yourapiKey"},
                    {"numbers" , "918123456789"},
                    {"message" , message},
                    {"sender" , "TXTLCL"}
                    });
            string result = System.Text.Encoding.UTF8.GetString(response);
            return result;
        }
    }
    

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Answers

  • YelinzhYelinzh Member, Xamarin Team Xamurai
    edited December 2020 Accepted Answer

    I want to get an Text from Front end and add an text to it. and Button to send an SMS.

    To get and modify the text of the front end, you could call the corresponding api methods.

    To send an SMS with 'TextLocal.in', you could try the following code:

    public string sendSMS()
    {
        String message = HttpUtility.UrlEncode("This is your message");
        using (var wb = new WebClient())
        {
            byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
                    {
                    {"apikey" , "yourapiKey"},
                    {"numbers" , "918123456789"},
                    {"message" , message},
                    {"sender" , "TXTLCL"}
                    });
            string result = System.Text.Encoding.UTF8.GetString(response);
            return result;
        }
    }
    

    Xamarin forums are migrating to a new home on Microsoft Q&A!
    We invite you to post new questions in the Xamarin forums’ new home on Microsoft Q&A!
    For more information, please refer to this sticky post.

Sign In or Register to comment.