Skip to content

Marketplace Widgets APIs

Opening and closing Marketplace

For Commerce Marketplace Widget integration, you need to use CommerceFragment. This is the start fragment for marketplace and it decides on the next fragment to be inflated inside its content, based on the arguments in the bundle received in onCreateView.

Open Marketplace

Using FragmentManager

1
2
3
4
5
6
7
8
9
val bundle = Bundle().apply {
            putString("info_type", "parking/food")
        }
this.supportFragmentManager.beginTransaction().add(
                R.id.widgets_fragment,
                CommerceFragment::class.java,
                bundle,
                CommerceFragment::class.java.name
            ).commit()

Open order details in Marketplace

Using intents

Action -> com.telenav.commerce.widgets.OPEN_COMMERCE_ORDER_DETAILS

1
2
3
4
5
6
val intent = Intent(
"com.telenav.commerce.widgets.OPEN_COMMERCE_ORDER_DETAILS",
Uri.parse("telenav://commerce.widgets")
)
intent.putExtra("info_type","parking/food") 
requireActivity().sendBroadcast(intent)

Note

*The info_type is not mandatory to be sent.

In case the bundle holds no information under the info_type key, than the Marketplace home will be displayed.

In case it holds the parking/food String information, it will try to display the details page of the last order of that certain type, information which is locally cached, otherwise Marketplace home will be displayed.*

Close Marketplace or Order details

Using FragmentManager

1
fragmentManager?.popBackStack()

Using intents

Action → com.telenav.commerce.widgets.HIDE_MARKETPLACE_WIDGET

1
2
3
4
5
val hideIntent = Intent(
"com.telenav.commerce.widgets.HIDE_MARKETPLACE_WIDGET",
Uri.parse("telenav://commerce.widgets")
)
requireActivity().sendBroadcast(hideIntent)