Expand my Community achievements bar.

Applications are now open to join the Adobe Experience Platform Champion Program. Apply by June 10!

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Multiple Context Data in a single trackState Or trackAction

Avatar

Level 2

Hello,

I am looking at the different documentation for the iOS and Android SDK and I am not sure if it is possible to send different context variable within the same State or Action.

Documentation State for iOS & Android:

It seems incredible that it is not possible, but how would you write that ?

@Override

public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    // Adobe - track when this state loads

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>();

    exampleContextData1.put("myapp.login.LoginStatus", "logged in");

    HashMap<String, Object> exampleContextData2 = new HashMap<String, Object>();

    exampleContextData2.put("myapp.login.Template", "templateB");

    Analytics.trackState("Home Screen", exampleContextData1,exampleContextData2);

}

Any help, would be appreciated.

Thanks

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee

Put each context data value in the same HashMap, and then pass one HashMap to the track call:

    // Adobe - track when this state loads  

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>(); 

    exampleContextData1.put("myapp.login.LoginStatus", "logged in"); 

    exampleContextData1.put("myapp.login.Template", "templateB"); 

 

    Analytics.trackState("Home Screen", exampleContextData1);

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

Put each context data value in the same HashMap, and then pass one HashMap to the track call:

    // Adobe - track when this state loads  

    HashMap<String, Object> exampleContextData1 = new HashMap<String, Object>(); 

    exampleContextData1.put("myapp.login.LoginStatus", "logged in"); 

    exampleContextData1.put("myapp.login.Template", "templateB"); 

 

    Analytics.trackState("Home Screen", exampleContextData1);

Avatar

Level 2

Thanks for your answer.
It exactly what I was looking for.