com.google.android.gms.tagmanager.ContainerHolder Java Examples
The following examples show how to use
com.google.android.gms.tagmanager.ContainerHolder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HomeActivity.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
public void loadGTMContainer () { // TODO Get the TagManager mTagManager = ((MangoBlogger) getApplication()).getTagManager(); // Enable verbose logging mTagManager.setVerboseLoggingEnabled(true); // Load the container PendingResult pending = mTagManager.loadContainerPreferFresh("GTM-PJT59FL", R.raw.gtmtag); // Define the callback to store the loaded container pending.setResultCallback(new ResultCallback<ContainerHolder>() { @Override public void onResult(ContainerHolder containerHolder) { // If unsuccessful, return if (!containerHolder.getStatus().isSuccess()) { // Deal with failure return; } // Manually refresh the container holder // Can only do this once every 15 minutes or so containerHolder.refresh(); // Set the container holder, only want one per running app // We can retrieve it later as needed ((MangoBlogger) getApplication()).setContainerHolder( containerHolder); } }, 2, TimeUnit.SECONDS); }
Example #2
Source File: HomeActivity.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 5 votes |
public void aboutPage(){ ContainerHolder holder = ((MangoBlogger) getApplication()).getContainerHolder(); DailySpecial = holder.getContainer().getContainerId(); DataLayer dl = mTagManager.getDataLayer(); dl.pushEvent("openScreen", DataLayer.mapOf( "screen-name","AboutPage" )); }
Example #3
Source File: ShadowsocksApplication.java From ShadowsocksRR with Apache License 2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); app = this; // init toast utils ToastUtils.init(getApplicationContext()); initVariable(); if (!BuildConfig.DEBUG) { java.lang.System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR"); } AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); checkChineseLocale(getResources().getConfiguration()); TagManager tm = TagManager.getInstance(this); PendingResult<ContainerHolder> pending = tm.loadContainerPreferNonDefault("GTM-NT8WS8", R.raw.gtm_default_container); ResultCallback<ContainerHolder> callback = new ResultCallback<ContainerHolder>() { @Override public void onResult(@NonNull ContainerHolder holder) { if (!holder.getStatus().isSuccess()) { return; } containerHolder = holder; Container container = holder.getContainer(); container.registerFunctionCallMacroCallback(SIG_FUNC, new Container.FunctionCallMacroCallback() { @Override public Object getValue(String functionName, Map<String, Object> parameters) { if (SIG_FUNC.equals(functionName)) { return Utils.getSignature(getApplicationContext()); } else { return null; } } }); } }; pending.setResultCallback(callback, 2, TimeUnit.SECONDS); JobManager.create(this).addJobCreator(new DonaldTrump()); if (settings.getBoolean(Constants.Key.tfo, false) && TcpFastOpen.supported()) { mThreadPool.execute(new Runnable() { @Override public void run() { TcpFastOpen.enabled(settings.getBoolean(Constants.Key.tfo, false)); } }); } }
Example #4
Source File: ShadowsocksApplication.java From Maying with Apache License 2.0 | 4 votes |
@Override public void onCreate() { super.onCreate(); app = this; // init toast utils ToastUtils.init(getApplicationContext()); initVariable(); if (!BuildConfig.DEBUG) { java.lang.System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "ERROR"); } AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); checkChineseLocale(getResources().getConfiguration()); TagManager tm = TagManager.getInstance(this); PendingResult<ContainerHolder> pending = tm.loadContainerPreferNonDefault("GTM-NT8WS8", R.raw.gtm_default_container); ResultCallback<ContainerHolder> callback = new ResultCallback<ContainerHolder>() { @Override public void onResult(@NonNull ContainerHolder holder) { if (!holder.getStatus().isSuccess()) { return; } containerHolder = holder; Container container = holder.getContainer(); container.registerFunctionCallMacroCallback(SIG_FUNC, new Container.FunctionCallMacroCallback() { @Override public Object getValue(String functionName, Map<String, Object> parameters) { if (SIG_FUNC.equals(functionName)) { return Utils.getSignature(getApplicationContext()); } else { return null; } } }); } }; pending.setResultCallback(callback, 2, TimeUnit.SECONDS); JobManager.create(this).addJobCreator(new DonaldTrump()); if (settings.getBoolean(Constants.Key.tfo, false) && TcpFastOpen.supported()) { mThreadPool.execute(new Runnable() { @Override public void run() { TcpFastOpen.enabled(settings.getBoolean(Constants.Key.tfo, false)); } }); } }
Example #5
Source File: MangoBlogger.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 4 votes |
public void setContainerHolder(ContainerHolder containerHolder) { mContainerHolder = containerHolder; }
Example #6
Source File: MangoBlogger.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 4 votes |
public ContainerHolder getContainerHolder() { return mContainerHolder; }
Example #7
Source File: ContainerHolderSingleton.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 4 votes |
public static ContainerHolder getContainerHolder() { return containerHolder; }
Example #8
Source File: ContainerHolderSingleton.java From MangoBloggerAndroidApp with Mozilla Public License 2.0 | 4 votes |
public static void setContainerHolder(ContainerHolder c) { containerHolder = c; }