How to launch Telegram app from my own android application?

BoshRa picture BoshRa · Mar 1, 2016 · Viewed 12.3k times · Source

I have an android app that should be able to open a chat in the telegram app by pressing a button.
I want to open an existing robot chat page DIRECTLY from my app. I have a valid token for my robot. How can this be achieved?

Thanks in advance.

robot name : @InfotechAvl_bot

robot token: 179284***********

   //-------------
    case ContentFragment.lMenuTelegram:
     Intent LaunchIntent=getPackageManager().getLaunchIntentForPackage("org.telegram.messenger");
     startActivity(LaunchIntent);
            break;

Answer

BoshRa picture BoshRa · Mar 1, 2016

I solved My problem. actually you have to open robot id with this :

         Intent telegram = new Intent(Intent.ACTION_VIEW , Uri.parse("https://telegram.me/InfotechAvl_bot"));
         startActivity(telegram);