自定义Chrome共享链接到在某些设备上无法使用的其他应用

问题描述

我正在使用自定义镶边在我的android应用中打开URL。除了工具栏上的共享选项,其他所有东西都可以正常运行。在一些设备中,它不起作用,根本没有任何动作。即使是某些使用自定义镶边选项卡的应用程序,它也无法在Play商店中提供的那些应用程序中运行。自定义标签是否存在任何问题,或者我们做错了什么?

此代码用于打开共享链接:

private static void setShareActionButton(Context context,CustomTabsIntent.Builder builder,String url) {
    Bitmap icon = BitmapFactory.decodeResource(context.getResources(),android.R.drawable.ic_menu_share);
    String label = "Share via";

    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_TEXT,url);
    shareIntent.setType("text/plain");

    PendingIntent pendingIntent = PendingIntent.getActivity(context,shareIntent,PendingIntent.FLAG_UPDATE_CURRENT);

    builder.setActionButton(icon,label,pendingIntent);
}

版本:

implementation "androidx.browser:browser:1.3.0-alpha05"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)