Expand my Community achievements bar.

Mobile mbox create A/B test - how to retrieve target Activity json

Avatar

Level 1

Hey everyone, 

I've implemented target sdk and initialised on android. Created an activity through target with 2 experiences as json format. 
I am trying to retrieve the data through the mbox i've create by using retrieveLocationContent && prefetchContent but so far i am not able to. AdobeCallback seems to be null all the time. 
Any help would be welcomed. Adding code as example below. I am expecting to retrieve the json as a JSONObject but i am not sure what to expect. No real example provided found and the test project (https://github.com/adobe/aepsdk-target-android/blob/main/Documentation/getting-started.md) which is on Java doesn't seem to be working properly or to mention how to create an A/B test activity and to handle the logic on app. 

fun retrieveLocation() {
val latch = CountDownLatch(1)
val callbackData = arrayOfNulls<String>(1)

val adobeCallback = AdobeCallback { data: String? ->
callbackData[0] = data
latch.countDown()
}

// load the requests using retrieve location content
val targetRequest = TargetRequest(MBOX1, null, DEFAULT1, adobeCallback)

val targetRequestList: MutableList<TargetRequest> = ArrayList()
targetRequestList.add(targetRequest)
Target.retrieveLocationContent(targetRequestList, null)
latch.await(5, TimeUnit.SECONDS)

if (callbackData[0] != null) {
if (callbackData[0] == DEFAULT1) {
println("Retrieve location content default content received: " + callbackData[0] + " for mbox: " + MBOX1)
} else {
println("Retrieve location content received: " + callbackData[0] + " for mbox: " + MBOX1)
mboxList.add(MBOX1)
}
}
}

Thanks in advance

Topics

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

0 Replies