3

I have installed the telegram app and just want to send a message (string) from my app through telegram to a contact.

All I found yet is in the question: How to send a Intent with telegram

with the code:

//Sending message
void intentMessageTelegram(String msg)
{
    final String appName = "org.telegram.messenger";
    final boolean isAppInstalled = isAppAvailable(this.getApplicationContext(), appName);
    if (isAppInstalled) 
    {
        Intent myIntent = new Intent(Intent.ACTION_SEND);
        myIntent.setType("text/plain");
        myIntent.setPackage(appName);
        myIntent.putExtra(Intent.EXTRA_TEXT, msg);//
        this.startActivity(Intent.createChooser(myIntent, "Kevin"));
    } 
    else 
    {
        Toast.makeText(this, "Telegram not Installed", Toast.LENGTH_SHORT).show();
    }
}

when I use that the telegram opens a contact list. But choosing multiple contacts, It is not sending it to them. If I click on one of them the message will be sent.

How can I send a message without displaying the telegram? Is there a way to read messages too?

Thanks in advance^^

TheLittleNaruto
  • 8,325
  • 4
  • 54
  • 73
Ghali
  • 275
  • 3
  • 15
  • 1
    See this workaround http://stackoverflow.com/questions/26691289/using-telegram-to-send-a-message/31649857#31649857 – Ilia P Jul 27 '15 at 10:33

0 Answers0