Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Telegram to send a message

I'm trying to send a message to a telegram-app user, but the intent opens only the telegram app - it don't choose a conctact and send the message:

public void shareTelegram(String message)
{
    Intent waIntent = new Intent(Intent.ACTION_SEND);

    waIntent.setType("text/plain");
    waIntent.setPackage("org.telegram.messenger");

    if (waIntent != null)
    {
        waIntent.putExtra(Intent.EXTRA_TEXT, message);//
        startActivity(Intent.createChooser(waIntent, "Daniel"));
    } 
    else 
    {
        Toast.makeText(getApplicationContext(), "Telegram is not installed", Toast.LENGTH_SHORT).show();
    }
}

Is there a way to send the message completely? Can I send the message completely without displaying telegram ?

like image 210
Ghali Avatar asked Nov 23 '22 09:11

Ghali


1 Answers

TLSharp is basic implementation of Telegram API on C#. See it here https://github.com/sochix/TLSharp

like image 108
Ilia P Avatar answered Nov 24 '22 22:11

Ilia P