Tokopedia always cares about our users. We want to give the best experience when users using our app. There is a lot of things that we can use. But now we are providing you the fastest way to access our feature in Tokopedia using Google Assistant.
In Tokopedia we have some problems that require a lot of steps to check out some products. For example, we have feature Top Up and Bills that need to open the Tokopedia app, input some client numbers, and checkout. Action and Slice can solve this problem for us. With this, users who want fast transaction can use feature Top Up and Bills with Google Assistant.
Slices are UI templates that can display rich, dynamic, and interactive content from your app from within the Google Assistant.
We must use Slice if we want to show our data in Google Assistant. Slice is using SliceProvider() as a Boilerplate to build our Slice. For example, let us see our MainSliceProvider.kt.
Like you see above in MainSliceProvider.kt, we are using onBindSlice(Slice:Uri) as our Main method to show our Slice in Google Assistant. If you notice, we use sliceUri.path to determine which Slice that we want to show.
Then we must register our provider to your AndroidManifest.xml. Please make sure your authorities on the right path.
Actions are Provide a faster way for users to access your Android app. Deep-link users directly into a specific activity using App Actions or surface relevant content on the Assistant with Slices.
Action has two types, Slice and Deeplink. You can use one of them or both of them. What are the differences between both of them?
Action with Slice
If you want to see the difference between both of them in the implemented feature, this is when we use Slice. There you can see that we show our Recharge Bill in Slice.
Action with Deeplink
Action with Deeplink is when we use Actions Deeplink. When you say “Get Tokopedia Bill” in Google Assistant, you will be redirected to Recharge Home of Tokopedia.
Then we need to make actions.xml and embed it to our AndroidManifest.xml.
Build-in Intents is the way our app to express its fulfillment to Google. If you want to your fulfillment be recognize by Google Assistant, you must register your fulfillment to your actions.xml. Build-in Intent is grouped and categorized per unique feature. For example we use GET_INVOICE to show our Recharge Bill in Tokopedia. For a list of built-in intents, they support for deep linking into your app or launching your custom slices, see Implement built-in intents for App Actions.
Build-in Intent has a parameter that we can use as a unique value used in our feature. For example we can use queries like “My Bill Electricity in Tokopedia.” The unique value here is “Electricity” and used as intentParameter.
If you want to test your Actions, you need to use the plugin App Action Test Tool. This Test Tool is listing your actions.xml and trigger your Google Assistant what intentName you choose. Please login to your Google Account, which has access to your playConsole to your Android Studio.
After knowing what Action and Slice are, you must understand that the category in Build-in-Intent is limited. In the food and drink category, for example, you only can use order menu item. For Transportation, you can only use create order taxi, cancel order taxi, and get order taxi. But what is the future Development in Tokopedia is possible to use? We can use pay invoice, get our order, and open feature. With this, we hope our user will have a better experience using Tokopedia App.
- Language in Action and Slice is something vital that we must know it is limited per Build-in-Intent. Some build intent has their list usable language keyword. For example, in Get Invoice, you can only use English, Spain, and Brazilian-Portuguese. Please pay attention to the language too.
- When you upload to the Play Store, and you are using proguard, please take notice that your proguard will remove your actions.xml. For avoid that, you can whitelist your actions.xml in your keep.xml so that your proguard does not remove your actions.xml
- Slice is a UI framework that we can use in our Assistant, to show our UI that we needed.
- Action is used to Provide a shortcut to your app as users talk to the Google Assistant.
- Action has two types, Slice and Deeplink. Slice will show UI in the Assistant. Deeplink will redirect you to your Activity.
- Testing Action using the account that can access playConsole, use your account in Android Studio and your Device.