Android TagManager does not get default values

I am trying to implement a fairly new Android TagManager from Google. I can't seem to load the defaults.

I created my default json file:

assets/tagmanager/GTM-xxx.json

Which looks like this:

{ 'eulaTextVersion': '1' }

I also added this code to actually pull out the default file if nothing was found on the server:

 TagManager mTagManager = TagManager.getInstance(this); // The container is returned to containerFuture when available. ContainerOpener.openContainer( mTagManager, // TagManager instance. CONTAINER_ID, // Tag Manager Container ID. OpenType.PREFER_NON_DEFAULT, // Prefer not to get the default container, but stale is OK. null, // Time to wait for saved container to load (ms). Default is 2000ms. new ContainerOpener.Notifier() { // Called when container loads. @Override public void containerAvailable(Container container) { // Handle assignment in callback to avoid blocking main thread. mContainer = container; } } ); int eulaTextVersion = (int) mContainer.getDouble("eulaTextVersion"); 

However, when I debug, my int eulaTextVersion always zero, I can never get it at 1, as if it should be from my json by default. Can someone please help me and show me where I am going wrong?

Thanks for the help.

+2
json android google-tag-manager
source share
2 answers

Google Tag Manager has probably already downloaded the first version for you. The first version is probably empty. Just make the next version with "Values" which contain "eulaTextVersion" and "Publish".

If you do not know how to set these values ​​in your Google Tag Manger account, see: http://youtu.be/Xe8W5w68BRg?t=8m26s

0
source share

You should not use quotes for numeric values. Try instead

 { 'eulaTextVersion': 1 } 
0
source share

All Articles