Chrome 电弧焊机 ACTION_SEND

Chrome ARC Welder ACTION_SEND

我在 Chrome ARC Welder 上尝试 运行 共享示例 apk,代码如下。

    Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.setType("text/plain");
    share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    share.putExtra(Intent.EXTRA_SUBJECT, "Title Of The Post");
    share.putExtra(Intent.EXTRA_TEXT, "Content of post");

    startActivity(Intent.createChooser(share, "Share"));

当我 运行 this then window 要求保存文件出现。当保存并打开文件时,只有内容出现。

在 Chome ARC 中是否有一些不同的处理共享的方式/action_send?

我尝试搜索参考资料/指南,但似乎没有找到。 任何参考资料/指南或任何示例都会非常有帮助。 谢谢

不幸的是,chromebook 中没有处理这些意图的应用程序。所以,你已经看到了那个问题。如果您想通过电子邮件分享,请尝试以下方法:

    if (isChromeApp()) {

            Intent emailIntent = new Intent(Intent.ACTION_VIEW,
                    Uri.parse("mailto:"));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
            emailIntent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(body));
            startActivity(emailIntent);

        } else {
//Android intent handler code
}

要知道它是否是 chromeapp,您可以使用以下函数:

private static final String CHROMIUM="chromium";


public static boolean isChromeApp() {
        if (Build.MANUFACTURER != null) {
            Log.d("manufacturer", Build.MANUFACTURER);
        }
        boolean isChromeApp = Build.MANUFACTURER != null
                && Build.MANUFACTURER.equalsIgnoreCase(CHROMIUM);
        Log.d("isChromeApp", isChromeApp ? "true" : "false");
        return isChromeApp;
    }

它将打开安装在您计算机中的默认电子邮件客户端。 希望这可以帮助。