I am trying to implement the fairly new Android TagManager from Google. I can't seem to be able to load the default values.
I have created my default json file:
assets/tagmanager/GTM-xxx.json
Which looks like this:
{ 'eulaTextVersion': '1' }
I have also added this code to actually pull the default file if nothing is 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
is always zero, I can never get it to 1 like it should be from my default json. Could someone please help me out and show me where I am going wrong?
Thank you for the help.