Android tracker: application_error: how can we attach a context

Hey there!

We noticed that our Android tracker is sending application_error events to our pipeline occasionally. We manage our device & user identity properties in a context, but for this automatically sent event there is no context attached. Can we configure which contexts are sent with this event?

Thanks for your help!

Hi @boba

From the Android tracker v.1.2.1 you can take advantage of the Global Contexts feature in order to add custom contexts to the events, even those automatically generated.

ContextPrimitive customCtx = new SelfDescribingJson(<schema of your context>, <data of context>);
RuleSet ruleSet =
    new RuleSet("iglu:com.snowplowanalytics.snowplow/application_error/jsonschema/1-0-*", null);

GlobalContext contextProvider = new RuleSetProvider("appErrorTag", ruleSet, customCtx);


The snippet of code above has to be declared at the tracker setup.
When an application_error is automatically tracked, the tracker will check if the event schema match and will add automatically the context you have generated customCtx.

Global Contexts feature can be used with all the events and it has a rich API enabling lot of freedom in the way to add custom contexts on the events.
More details in the docs:

If you have any further questions, please don’t hesitate to get back to us.


Alex, huge thanks for your help. will try it later. may i come back asking some additional questions if you don’t mind? thanks again

1 Like

Sure, feel free to share any question and feedback. It can be helpful for other members of the community and it helps us to improve the trackers even more!