本文整理汇总了Java中org.chromium.customtabsclient.shared.CustomTabsHelper.addKeepAliveExtra方法的典型用法代码示例。如果您正苦于以下问题:Java CustomTabsHelper.addKeepAliveExtra方法的具体用法?Java CustomTabsHelper.addKeepAliveExtra怎么用?Java CustomTabsHelper.addKeepAliveExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.customtabsclient.shared.CustomTabsHelper
的用法示例。
在下文中一共展示了CustomTabsHelper.addKeepAliveExtra方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchCustomTabs
import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
private void launchCustomTabs(String url) {
String packageName = CustomTabsHelper.getPackageNameToUse(this);
if (TextUtils.isEmpty(packageName)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return;
}
Intent snsIntent = new Intent(this, SessionBroadcastReceiver.class);
PendingIntent snsPendingIntent = PendingIntent.getBroadcast(this, 121, snsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder(session)
.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary))
.setActionButton(ResourceUtil.createBitmap(SessionActivity.this, icons[0]), "SNS", snsPendingIntent)
.addMenuItem("toggle", createRemoteViewPendingIntent(this))
.setSecondaryToolbarViews(SessionBroadcastReceiver.createRemoteView(), ids, null)
.build();
customTabsIntent.intent.setPackage(packageName);
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
customTabsIntent.launchUrl(this, Uri.parse(url));
}
示例2: launchCustomTabsWithSessionBottombar
import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
public void launchCustomTabsWithSessionBottombar(Activity activity, String url, @Nullable CustomTabsSession session) {
String packageName = CustomTabsHelper.getPackageNameToUse(activity);
if (TextUtils.isEmpty(packageName)) {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
CustomTabsIntent.Builder builder;
if (session == null) {
builder = new CustomTabsIntent.Builder();
} else {
builder = new CustomTabsIntent.Builder(session);
}
// Intent hacked
Intent cctIntent = new CustomTabsIntent.Builder(session).build().intent;
cctIntent.setData(Uri.parse(url));
PendingIntent cctPendingIntent = PendingIntent.getActivity(activity, 124, cctIntent, PendingIntent.FLAG_UPDATE_CURRENT);
addSessionBottombar(builder, activity, cctPendingIntent);
CustomTabsIntent customTabsIntent = builder
.setToolbarColor(Color.WHITE)
.build();
CustomTabsHelper.addKeepAliveExtra(activity, customTabsIntent.intent);
customTabsIntent.intent.setPackage(packageName);
customTabsIntent.launchUrl(activity, Uri.parse(url));
}
示例3: launchCustomTabs
import org.chromium.customtabsclient.shared.CustomTabsHelper; //导入方法依赖的package包/类
private void launchCustomTabs(String url) {
String packageName = CustomTabsHelper.getPackageNameToUse(this);
if (TextUtils.isEmpty(packageName)) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return;
}
// Put session
CustomTabsIntent customTabsIntent = new CustomTabsIntent.Builder(session)
.build();
customTabsIntent.intent.setPackage(packageName);
// Keep alive service
CustomTabsHelper.addKeepAliveExtra(this, customTabsIntent.intent);
customTabsIntent.launchUrl(this, Uri.parse(url));
}