0

Is it possible to open mobile Telegram client with link? For example

imgVk.setOnClickListener(new OpenLinkListener(getActivity(), "vk.com/id23**36*35"));

is opening userpage in mobile Vk client.

But,

imgTelegramMe.setOnClickListener(new OpenLinkListener(getActivity(), "web.telegram.org/#/im?p=@Artem_NeFRiT"));

is not working... It just opens the web browser...

EDIT

imgTelegramMe.setOnClickListener(new OpenLinkListener(getActivity(), "telegram.org/#/im?p=@Artem_NeFRiT"));

doesn't work too

SOLUTION

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=Artem_NeFRiT"));
            startActivity(intent);

but u have to check for ActivityNotFoundException if there is no mobile Telegram client.

ArtemNeFRiT
  • 228
  • 1
  • 2
  • 14
  • Whether the link opens in an app or in the browser is determined by whether the target app supports it or not. See http://stackoverflow.com/questions/525063/android-respond-to-url-in-intent – Andrew Sun Aug 13 '16 at 07:28
  • Yes, thanks, I know that. But I don't know, does Telegram client support that? – ArtemNeFRiT Aug 13 '16 at 07:33
  • Does this help? http://stackoverflow.com/questions/34692116/open-telegram-channel-in-android – Andrew Sun Aug 13 '16 at 07:35
  • Sorry, It seems that I am so blind... Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tg://resolve?domain=Artem_NeFRiT")); startActivity(intent); works perfectly with Telegram client – ArtemNeFRiT Aug 13 '16 at 07:41

0 Answers0