使用 builder 构建 CustomTabsIntent 并设置 setActionButton 时:
new CustomTabsIntent.Builder(getSession())
.setActionButton(getShareIcon(),
"Share text",
getShareIntent(),
true)
.build()
getShareIntent 的粗略实现:
@NonNull
private PendingIntent getShareIntent() {
Intent shareIntent = new Intent(mContext, ShareBroadcastReceiver.class);
shareIntent.putExtra("extra", someValue);
return PendingIntent.getBroadcast(mContext, 0, shareIntent, 0);
}
我希望在我的广播接收器中获得额外的内容。它可以工作,但是当我用不同的“someValue”重建它时,我收到了初始的 someValue。
自定义选项卡似乎只发送初始意图并忽略更新的意图,直到自定义选项卡服务重新启动。
该行为未记录在案。它是一个错误吗?