I am trying to create a class in java which manages different social sharing apps. The class is based on android intents.
but when I try to execute Telegram intent, it doesn't find the app.
Here I put the code I have written:
public void shareTelegram(String message)
{
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
waIntent.setPackage("com.telegram");
if (waIntent != null) {
waIntent.putExtra(Intent.EXTRA_TEXT, message);//
_androidActivity.startActivity(Intent.createChooser(waIntent, "Share with"));
}
else
{
Toast.makeText(_androidActivity.getApplicationContext(), "Telegram is not installed", Toast.LENGTH_SHORT).show();
}
}
Where could I find the package name? Thanks in advance.
All Android app have an unique ID, market ID. If you look into Google Play or google search market://details?id=org.telegram, It send you to
If you send the intent with:
It will work.
If you prefer a little bit complex system I recommend you to use:
And check if is installed with:
For opening telegram channel :