4
votes

I have read through all the posts here and other and can not find out how to make this work.

I am following this from google: https://developers.google.com/tag-manager/android/v4/

In it is says to download a binary. However, I have no option at all on my container to download a binary file for the container. Only JSON.

I verified that the container is set to Android.

When I try to use the JSON file like the following:

TagManager tagManager = TagManager.getInstance(this);
    PendingResult<ContainerHolder> pending =
            tagManager.loadContainerPreferNonDefault(CONTAINER_ID,
                    R.raw.gtm_default_container_json);

It fails with:

java.lang.RuntimeException: JSONArrays are not supported

Any help with this would be appreciated!!

Thanks!

2
Did you publish a version? You should be able to "Download" rather than "export" a version but the option appears only once it is published..lossleader
This did the trick! Thank you! Can you post as an answer and I will accept it?DJH
I'm glad it worked, I've added an answer that's hopefully clearer than my comment for other people with the same question later.lossleader

2 Answers

2
votes

On the draft version or a web container, Download is not enabled, so the menu looks like this: Draft mobile container menu

(Export is not the correct method, it creates a JSON file that is primarily used to copy configurations within the tag manager GUI.)

For a Published (or really any non-draft) Mobile container, you will have the option to Download: Finalized mobile container menu

The container version you download and embed will be applied by new downloads of your application and determine what the tracking they generate looks like until they are able to download your latest published version.

1
votes

If approved solution doesn't work for you, maybe it's because you are implementing the legacy version of Google Tag Manager but configured the container as a Firebase instead of Legacy.

Create a new Legacy(Android) container and then you can download the binary file.