Android Inline Inquiries Guide
Persona inquiries are usually launched as fullscreen experiences on Android, but it is possible to launch inquiries inline using the SDK. Android Fragments are used when launching inquires inline.
A sample project can be found here. This sample project demonstrates one method of launching an Inquiry inline.
Building an Inline Inquiry
An Inquiry fragment is necessary to launch an Inquiry inline. To build an Inquiry fragment, create a regular inquiry builder and configure it to your needs. Then call toInlineInquiryBuilder()
on the builder to turn the it into an InlineInquiryBuilder
. The InlineInquiryBuilder
offers additional configuration options specific to the inline experience.
Call createFragment()
on the InlineInquiryBuilder
to get an Inquiry fragment.
Attaching the fragment
The Inquiry fragment can be attached like any other Android fragment. You can choose to attach the fragment to an Activity or Fragment. An example of how to attach the fragment is shown below.
Getting results from an inquiry fragment
The Inquiry fragment uses the Android Fragment Result API to return results back to the host Activity/Fragment. The results are returned inside the result Bundle. You will need to call Inquiry.extractInquiryResponseFromBundle()
to get the Inquiry result.
Using custom navigation UI
The InlineInquiryBuilder
offers several additional customization options such as hiding the built-in navigation UI. If you wish to provide your own navigation UI you can control the Inquiry fragment using the InlineInquiryScreen
object.
You can see how to obtain the InlineInquiryScreen
object below.
Once you have an instance of InlineInquiryScreen
, you can use it to control the inquiry.
Inquiries can have complex states where the back and/or the close actions are not available. It is recommended that you handle these state changes when providing custom navigation UI.
Observe state changes by collecting InlineInquiryScreen.screenStateFlow
. Then update the navigation UI according to the current state.