Reputation: 3306
I have a question.
I need to use intent share the link text to LINE App in Android.
But I don't know how to share hyperlink text to Line.
I know share the text to LINE message. below:
intent.setAction(Intent.ACTION_SEND);
intent = mContext.getPackageManager().getLaunchIntentForPackage(
AppConfig.LINE_PACKAGE_NAME);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "this is share text but I want to set hyperlink");
mContext.startActivity(intent);
Have anyone know how to set text link(ex:link to www.google.com) use intent and share to LINE App in android?
Thank you very much.
Upvotes: 3
Views: 6340
Reputation: 190
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
//intent.setData(Uri.parse("line://msg/text/" + msg)); // "line://" is deprecated
intent.setData(Uri.parse("https://line.me/R/share?text=" + URLDecoder.decode(msg, "UTF-8")));
startActivity(intent);
the LINE Official recommond use https://line.me/
link: https://developers.line.biz/en/docs/messaging-api/using-line-url-scheme/#available-line-url-schemes
Upvotes: 0
Reputation: 21
public static void openLine(Context context, String number, String msg) {
try {
final String appName = "jp.naver.line.android";
final boolean isAppInstalled = isAppAvailable(context, appName);
if (isAppInstalled) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("line://msg/text/" + msg));
context.startActivity(intent);
} else {
Toast.makeText(context, "Line not Installed", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Log.e("ERROR LINE", e.toString());
Toast.makeText(context, "Line not installed in your device", Toast.LENGTH_LONG).show();
}
}
Upvotes: 2
Reputation: 1
Just add the hyper link to the end of the text:
intent.putExtra(Intent.EXTRA_TEXT, "this is share text but I want to set hyperlink" + url);
Upvotes: 0
Reputation: 3306
I found the answer.
Just to write the hyper link text.
The Line app will auto generate the hyper link in there message panel.
Upvotes: 0