相反來說, 若是想利用自己的app去發request 就要去add naver/facebook 的library, 這樣能做到的事更多, 但是較為麻煩。
這邊將介紹如何透過簡單的方式來PO文到line上
//判斷是否安裝了line
private boolean checkLineInstalled(){PackageManager pm = getPackageManager();m_appList = pm.getInstalledApplications(0);boolean lineInstallFlag = false;for (ApplicationInfo ai : m_appList) {if(ai.packageName.equals(PACKAGE_NAME)){lineInstallFlag = true;break;}}return lineInstallFlag;}
//PO文字
public static final String PACKAGE_NAME = "jp.naver.line.android";public static final String CLASS_NAME = "jp.naver.line.android.activity.selectchat.SelectChatActivity";
Intent intent = new Intent(Intent.ACTION_SEND);intent.setClassName(PACKAGE_NAME, CLASS_NAME);intent.setType("text/plain");intent.putExtra(Intent.EXTRA_TEXT, sendText);startActivity(intent);
//PO圖片
String fname = "send_image.jpg";String fileFullPath = Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separator + fname;
Uri uri = Uri.fromFile(new File(fileFullPath));Intent intent = new Intent(Intent.ACTION_SEND);intent.setClassName(PACKAGE_NAME, CLASS_NAME);intent.setType("image/jpeg");intent.putExtra(Intent.EXTRA_STREAM, uri);startActivity(intent);
Reference: https://gist.github.com/ekos/3993270
帶出所以有可以share的app
Reference:http://orgcent.com/android-app-intent-share-list/
Are there any one click posting message to LINE sns, please share, thank you
回覆刪除sorry, I can't help you, you have to read the website(http://developer.naver.com/wiki/pages/OpenAPI)
刪除請問有可能同時發送圖片和文字訊息嗎?
回覆刪除