This allows selecting specific journeys on the mobile channel.
There are 3 ways how we can access specific journey select one best fitting your case:
1 – Provide journey GUID when creating a customer journey intent
Kotlin
val config = CustomerJourneyConfig.Builder(baseUrl = baseUrl,credentials = Credentials(username, password),journeyDefinitionId = journeyDefinitionGUID // Add hardcoded or retrieved journeyDefinitionId).build()// Call to open Customer Journeyval customerJourney = Intent(this, CustomerJourneyActivity::class.java)customerJourney.putExtra(CustomerJourneyActivity.EXTRA_CONFIG, config)startActivity(customerJourney)
2 – Fetch possible journeys on the mobile channel and ask customer journey to use the selected one.
Kotlin
privateval callback = object : OnJourneyDefinitionCallback {override fun onError(code: Int, message: String) {// Returns server error, check section: Web errors}override fun onSuccess(list: List<JourneyDefinition>) {// Returns list of JourneyDefinitions}}enterpriseService.getPossibleJourneyDefinitions(callback)
Follow starting intent from 1 example.
3 – Select journey on the go from a listener if there is more that one choice it will return selection if not it will skip callback.
Kotlin
privateval multipleJourneyDefinitionEventReceiver = object : MultipleJourneyDefinitionEventReceiver() {override fun onList(list: List<JourneyDefinition>): String {Toast.makeText(this@CustomerJourneySample, "Name: ${list.last().name}", LENGTH_LONG).show()// Parse list and select journey definition id you are interested in and return it.// For more information on JourneyDefinition check section:returnlist.last().journeyDefinitionId}}//Register for callbacks - this activates the server callMultipleJourneyDefinitionService.registerEventReceiver(this, multipleJourneyDefinitionEventReceiver)// Unregister from the callbacks when doneMultipleJourneyDefinitionService.unregisterEventReceiver(this, multipleJourneyDefinitionEventReceiver)
Launch Customer Journey as normal