-3

I'm new in android intent System , i want send a text message from my special application to telegram application !
Notic: i want send a TEXT from my application to telegram installed in this device only NOT other peaple telegrams , when i installed my telegram application i must enter a text and time . and on this time my telegram must open and show my text to myself.

this link can not help me because it want to send message to special contact not to self ! Android send message through telegram?


And i tried this but it'snot my goal

 Intent myIntent = new Intent(Intent.ACTION_SEND);
        myIntent.setType("text/plain");
        myIntent.setPackage(appName);
        myIntent.putExtra(Intent.EXTRA_TEXT, msg);//
        mUIActivity.startActivity(Intent.createChooser(myIntent, "Share with"));

pls give me a solution or link about hove i can send text/String to messanger apps by Intent from my special application in Android
Thanks

Community
  • 1
  • 1
SAYE
  • 1,247
  • 2
  • 20
  • 47

2 Answers2

2
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT,YourTextHere);
sendIntent.setType("text/plain");
sendIntent.setPackage("org.telegram.messenger");
try{
    startActivity(sendIntent);
}
catch (android.content.ActivityNotFoundException ex){
    Toast.makeText(getApplicationContext(),"Install Telegram",Toast.LENGTH_LONG).show();
}
Dhinakaran Thennarasu
  • 3,336
  • 4
  • 26
  • 39
  • if you read my Question i say that i want to send a text to my telegram . your answer is not correct because this code share a text with telegram contact , i want to send text to my self telegram not share a text with contacts when i click a button in my app i must recive a text from special name i n my telegram – SAYE Oct 21 '15 at 09:22
0

According to this answer you can not do such thing. Unless you use telegram api in your app.

Community
  • 1
  • 1
Sam
  • 446
  • 7
  • 17