<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rizqi Aryansa on Medium]]></title>
        <description><![CDATA[Stories by Rizqi Aryansa on Medium]]></description>
        <link>https://medium.com/@rizqi.aryansa?source=rss-287c5b536604------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YXlGBPfe2sulDo2-.</url>
            <title>Stories by Rizqi Aryansa on Medium</title>
            <link>https://medium.com/@rizqi.aryansa?source=rss-287c5b536604------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:01:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rizqi.aryansa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How a Bubble Chat Increases Up to 90% of Seller’s Read Speed]]></title>
            <link>https://medium.com/tokopedia-engineering/how-a-bubble-chat-increases-up-to-90-of-sellers-read-speed-29f96ff907ed?source=rss-287c5b536604------2</link>
            <guid isPermaLink="false">https://medium.com/p/29f96ff907ed</guid>
            <category><![CDATA[chat]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Rizqi Aryansa]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 04:19:38 GMT</pubDate>
            <atom:updated>2024-02-27T04:19:38.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hd3CK8N8wP9uZt6iy9FCEg.png" /></figure><h3>Why should Tokopedia have Bubbles?</h3><p>In Tokopedia, we believe that communication between sellers and buyers are important to ensure the transaction will go smoothly. Like many e-commerce platforms out there, the communication in Tokopedia between sellers and buyers is done mainly using a chat room.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*1CcBhqZ4aVNtlD-_Mmn9IA.gif" /><figcaption>Credits: <a href="https://giphy.com/gifs/multitasking-hHMEpcih7f1LalTOfj">Best Friends Coffee GIF</a></figcaption></figure><p>On a daily basis, Seller receives a hundred chats. While also they are not 100 percent dedicating their time to replying to chat as they are also doing other work instead. They could be opening the other apps instead of Tokopedia Seller, browsing, watching movies, or even playing games on their phone while a promising buyer was asking for their products in the chat.</p><p>While quick responses will make sellers more trustworthy. It will also increase the probability of the transaction being through as a longer response time can make buyers look for other sellers instead. This is a pain point for sellers since their performance also relies on their response time.</p><h3>Goals</h3><p>So to avoid any miscommunication between Sellers and their potential buyers, Sellers should be able to:</p><ul><li>Access the most urgent chat faster</li><li>Respond faster, Sellers need to be able to access the chatroom faster. So that more incoming orders can be generated</li></ul><p>Here, our team has decided to implement the Bubble Chat features in Tokopedia SellerApp. It enables chats to appear in a pop-up Bubble over other apps’ screens, making it easier for Sellers to see incoming chats and making it easier for them to access the chatroom; hence reply faster.</p><p>As Android Developers explored the opportunity to solve the problem, our research showed that Google has released an API that could help with those use cases. We finally decided to use <strong>Bubbles </strong>API.</p><h3>What is Bubbles? And how is its behavior?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*mOtaJ1IaSYIe1zlgY7lrhw.gif" /><figcaption>Bubble Chat Demo</figcaption></figure><p>Before we explore the implementation, it’s crucial to understand the overall behavior of this Bubbles feature. This will help us identify the aspects that can be advantageous for us and align with our needs in addressing the initial issues (Sellers and Buyers). Additionally, it allows us to prepare for the potential user or technical challenges by implementing necessary mitigation strategies.</p><p>Bubbles API started in Android 11 or later OS versions, previously developed by the Android team in the developer preview for Android 10. Bubbles are integrated into the Notification system with several user behaviors, including:</p><ul><li>Bubbles can be expanded to reveal app functionality and information or collapsed when not in use.</li><li>Bubbles float on top of other apps’ content, and clicking the shortcut icon in the push notification bar makes them appear.</li><li>The most recent chat bubbles appear on the far left.</li><li>Bubbles only display 5 shortcuts; additional ones are shown by clicking the plus icon, depending on the OS version.</li><li>Android provides one floating Bubble for multiple applications that support Bubbles.</li></ul><h3>Bubbles Implementation Journey on Tokopedia Seller App</h3><p>Alright, In this section we would like to explain in general how to implement notification Bubbles. The Bubbles are created into the Notification API, and according to <a href="https://developer.android.com/develop/ui/views/notifications/bubbles">Bubble Documentation</a>, Bubble API has three components that have to be implemented including the <strong>MessagingStyle</strong>, <strong>SharingShortcut</strong>, and <strong>BubbleMetaData</strong>.</p><p><strong>Prerequisites</strong></p><ul><li>For the <strong>targetSdkVersion</strong>, you should set Android 11 (Android API 30) or later.</li><li>The minimum <strong>AndroidX.core</strong> version required for Bubble support is 1.5.0. However, it is recommended to use version 1.7.0 or the latest version, according to the <a href="https://developer.android.com/jetpack/androidx/releases/core">Androidx.core</a> documentation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*JRshVimAxM5Zf_WY0mzxrg.png" /><figcaption>Bubbles Components</figcaption></figure><h4><strong>Messaging Styles</strong></h4><p>According to the <a href="https://developer.android.com/develop/ui/views/notifications/build-notification#messaging-best-practices">Notification documentation</a>, Starting Android 7.0 to implement best practices within the Notification, it’s recommended to use <strong>NotificationCompat.MessagingStyle</strong>. This approach allows for more customization, including conversational titles, additional messages, and custom content views (e.g., avatars). There are many benefits to using <a href="https://developer.android.com/reference/android/app/Notification.MessagingStyle">MessagingStyle</a> than the old approach using <strong>BigTextStyle</strong> or <strong>InboxStyle</strong> itself.</p><h4><strong>Sharing Shortcut</strong></h4><p>After implementing messaging styles, we continued to implement the Sharing Shortcut. Notifications must be associated with a reference to a long-lived shortcut, enabling straightforward content sharing in conversations directly from the published notification.</p><h4><strong>BubbleMetaData</strong></h4><p>BubbleMetaData is one of the most important to implement Bubbles, The BubbleMetaData class has the responsibility for launching the intent, setting the Bubble height layout, and displaying the avatar based on the icon parameters including the width and height of the avatar.</p><h4><strong>Person</strong></h4><p>Messaging Styles and Sharing Shortcuts should implement the Person class. Person class is used to associate a sender or recipient with messages within notifications. The Person class will help with the representation of messages by displaying the sender’s name and an adaptive Icon as a Bubble avatar.</p><h4><strong>Icon</strong></h4><p>The icon in the Bubbles is one of the most important to handle your Bubbles to ensure delivering bubbles features with a seamless experience. Since your Bubbles avatar icon comes from the Backend team as an image URL, you need to convert the image URL first to Bitmap in the IconCompat class. In the past, we learned something from this conversion process, if you’re not handling it properly the notification or Bubbles will crash or it will not display to the users.</p><p>How to prevent the crash or issue? When the process of converting the image URL to Bitmap, we need a few seconds to set the threshold time and make sure the notification is not delaying the process of converting the image URL to Bitmap. In case the conversion fails, you should set the default avatar to prevent a broken user’s experience.</p><p>Additionally, to prevent repeated requests for the same image, we utilize a caching mechanism to improve performance.</p><p>For full implementation of Bubbles can be read on the <a href="https://github.com/android/user-interface-samples/tree/main/People">sample app</a>.</p><h3>How are Sellers aware of this Bubbles feature?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*vdkuJVf5YPTvlAcZTqJ0Lw.gif" /><figcaption>Bubble Chat awareness flow for Seller</figcaption></figure><p>Before we get into explaining the Monitoring Bubbles, we had a challenge: how do we let sellers know we got this cool new feature that could really help them out?</p><p>Currently, the Bubbles entry point is built only at the right bottom of incoming notification and it’s highly and definitely skippable for some users. Even me and my team don’t know how to access Bubbles easily.</p><p>Our sellers have diverse profiles, and not all of them may be familiar with the Bubbles feature. To address this, we collaborated with the Product, Product Design, and Data teams to boost awareness. Our objective is to introduce sellers to Bubbles by implementing a ticker in the Seller chat list and the Seller Chat Settings. The objective is to introduce how to use the Bubbles to our sellers such as implementing the ticker in the Seller Chat list and also in the Seller Chat Setting.</p><blockquote><strong>Impacts</strong>: The feature’s awareness initiative has generated positive results, with an adoption rate in the thousands, showcasing its effectiveness.</blockquote><h3>Monitoring the Bubbles by implementing tracker</h3><p>As Android developers, implementing a chat bubbles is not just about getting things done; it’s crucial to monitor the performance of this bubbles feature. Therefore, we need to implement a tracker within the chat bubbles so that we can improve performance based on user usage in the future.</p><p>To properly implement the tracker, we must understand the lifecycle of the chat bubbles and know how to distinguish between a chat bubbles screen and a regular screen. This ensures that the tracker works accurately, without any errors in its implementation within the chat bubbles.</p><h4>Bubble Lifecycle Explanation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*fCjZ6YyTxe-HNa95lzkrJQ.png" /><figcaption>Bubble Lifecycle</figcaption></figure><p>As you know, the Bubbles launched used the Activity class and it is similar to the normal page as usual. In this part, I would like to explain the Bubbles lifecycle that we experienced when implementing the Bubbles feature. Okay, let’s say sellers have many chats from buyers, and notifications are coming.</p><p>The first time a notification is received, Bubbles has not been created yet. When notifications arrive and a seller clicks on the Bubbles chat entry point in the notification tray or popup, it triggers onCreate() and continues until the activity reaches the onResume() lifecycle.</p><p>When the next notification comes and the Bubbles have been created, but the bubble position is collapsed, the Bubbles still stay in the onStop()<strong> </strong>lifecycle with the new flag thus indicating an incoming new message which is a red dot in the Bubble avatar.</p><p><strong>How about the onStop lifecycle in the Bubble Activity?<br></strong>If your page has a back button, you should override the onBackPressed() method as usual. When the user clicks the back button, the activity will enter the onStop() lifecycle.</p><p><strong>How do I destroy the Bubble activity?<br></strong>As you may know, when used programmatically, we simply invoke the finish() method within the Activity class, or you can use cancel(notificationId) it in the notification. Afterward, the Bubble will be destroyed or dismissed. Alternatively, the user can manually drag the Bubble to the close button at the bottom.</p><h4>How do we differentiate the Bubble Screen and the Normal Screen?</h4><p>As mentioned earlier, after understanding the bubble lifecycle, it’s also crucial to know how to distinguish between bubble screens and normal screens to properly implement trackers in a bubble.</p><p>So, the Android API library provided the flag to differentiate between Bubble Screen and Normal Screen. In the starting <a href="https://developer.android.com/jetpack/androidx/releases/core#1.7.0-alpha02">AndroidX Core 1.7.0 </a>version, we’re able to use the isLaunchedFromBubble flag from <strong>ActivityCompat</strong> to differentiate between the Bubble Screen and Normal Screen like the code below.</p><pre>val isLaunchedFromBubble = ActivityCompat.isLaunchedFromBubble(activity)</pre><h3>Mitigate Users’ Issues with Bubbles Settings</h3><h4>How do we allow Sellers to manage settings in the Bubbles Chat?</h4><p>When rolling out a new feature, it’s important to think about ensuring a smooth experience for users who may not be familiar or not comfortable with it. We discovered the Bubbles Settings page in the Android Documentation, which helps in seamlessly introducing the Bubbles feature. This page can be a lifesaver, preventing a ton of complaints, as sellers can easily disable Bubbles directly from the Bubbles settings page.</p><p>Here is an intent name you could redirect to <a href="https://developer.android.com/reference/android/provider/Settings#ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS">Bubbles settings</a> based on your app package.</p><pre>val bubbleSettingsIntent = Intent(Settings.ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*mOnDlITxiuzDwcW07SQIzg.jpeg" /><figcaption>Bubbles Settings Page</figcaption></figure><p>On the Bubble Settings Page, there are three options you can choose to manage the Bubbles. These are:</p><ul><li><strong>All Conversations can bubble</strong>: When new notifications come from the user (buyer), the notification will always appear as a Bubble. Even though the user doesn’t click on the Bubble notification entry point.</li><li><strong>Selected conversations can bubble: </strong>This preference will be selected if the user has clicked any notifications as the Bubble.</li><li><strong>Nothing can bubble: </strong>If you want all the notifications not appear as a Bubble even though the conversation has already been enabled.</li></ul><h4><strong>Can we check the Bubble setting preference programmatically?</strong></h4><p>Absolutely!! Fortunately, the Android team provided the Bubbles preference method from the <strong>NotificationManager</strong> class, allowing us to easily check whether Bubble settings were enabled or not in the Seller App. Here’s a sample code you can try:</p><pre>private val notificationManager: NotificationManager? = ContextCompat.getSystemService(context, NotificationManager::class.java)<br><br>val bubbleSettingPreference = notificationManager.bubblePreference</pre><p>Also, The <strong>NotificationManager</strong> class has provided the three constants, which can be checked along the <strong>BubblePreference</strong> method</p><ul><li>BUBBLE_PREFERENCE_ALL</li><li>BUBBLE_PREFERENCE_SELECTED</li><li>BUBBLE_PREFERENCE_NONE</li></ul><h3>Recap</h3><ul><li>Our journey was truly worth it as the Bubble Support for Sellers initiative, supported by ticker awareness, help pages accessible within Bubble Chat onboarding, mitigation documents, etc., proved to be genuinely beneficial for our end-users.</li><li>Consider providing seamless experience by converting the image URL to a Bitmap in the IconCompat class for Bubble shortcuts.</li><li>When implementing a new feature, as a developer we should think of a long-run plan, such as mitigating the risk, etc.</li></ul><p>Collaborating with tech, product, and design teams was impactful but posed challenges, especially in implementation. But it pays off! The Seller Bubble feature <strong>increased sellers’ read speed by up to 90%, leading to faster reply speeds and a notable rise in daily orders</strong>. These outcomes highlight how the feature significantly improves communication between sellers and buyers, resulting in increased daily transactions.</p><h3>Credits</h3><p>A big shout-out to our Tech counterparts: <a href="https://medium.com/@reivinoktavianus">Reivin Oktavianus</a>, <a href="https://medium.com/@kelvin.saputra">Kelvin Saputra</a>, our Android Leaders, Product, Product Design, Data, and Test Engineer Teams for making this incredible collaboration a reality! Thank you for your efforts in bringing the Bubble Support for Sellers initiative to live!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29f96ff907ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tokopedia-engineering/how-a-bubble-chat-increases-up-to-90-of-sellers-read-speed-29f96ff907ed">How a Bubble Chat Increases Up to 90% of Seller’s Read Speed</a> was originally published in <a href="https://medium.com/tokopedia-engineering">Tokopedia Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why should you use the Dependency Injection on Android?]]></title>
            <link>https://medium.com/@rizqi.aryansa/why-should-you-use-the-dependency-injection-on-android-8102249c454b?source=rss-287c5b536604------2</link>
            <guid isPermaLink="false">https://medium.com/p/8102249c454b</guid>
            <category><![CDATA[architecture-components]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Rizqi Aryansa]]></dc:creator>
            <pubDate>Thu, 13 Sep 2018 15:16:33 GMT</pubDate>
            <atom:updated>2018-09-14T01:59:52.679Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everybody, I want to share a few things DI (Dependency Injection) on Android. A lot of things happen when having a big scale android project, for example when the objects within the class are getting complex which can cause high coupling. The principle of good software is that <strong>loosely coupled, highly modular</strong>. DI is a <strong>pattern</strong>, not a framework. <a href="https://en.wikipedia.org/wiki/Dependency_injection">Dependency Injection</a> is a decoupled object to the extent that no client code has to be changed simply because an object it depends one needs to be changed to a different one.</p><p>It’s also for improving the inter-object not a dependency in a class with another, reducing the amount of boilerplate code required, easier to manage dependencies between objects and also allow for explicit flow to write testable code.</p><p>What are the <strong>advantages</strong> of using dependency injection?</p><ul><li>More reusable code.</li><li>More testable code.</li><li>More readable code.</li><li>Reduced dependencies coupling between a class.</li><li>Etc.</li></ul><p><strong>Disadvantages</strong></p><p>- Difficult code to trace (read) because it separates behavior from construction.</p><p>- Requires more upfront development effort.</p><p>- Makes the client onerous when configuration details are supplied by construction code.</p><p><strong>Dependency Injection (DI) on android</strong> generally describes an architectural pattern design that focuses on <strong>service/data</strong>. So that each class has clear function rules, because using without DI like a Venn diagram between classes and depends on other objects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*nCHAP1oywgMsfWKGC6JWng.png" /><figcaption><strong>Source: </strong><a href="https://www.youtube.com/watch?v=oK_XtfXPkqw&amp;t=262s"><strong>Youtube Google Developers I/O 2014</strong></a></figcaption></figure><p><strong>Sample Class Diagram and Sequence diagram for the Dependency Injection Design pattern.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*rXDjlY-rUqDsAlv0dBACJA.png" /><figcaption><strong>Source: </strong><a href="https://en.wikipedia.org/wiki/Dependency_injection"><strong>Wikipedia</strong></a></figcaption></figure><p><strong>Four basic roles in Dependency Injections</strong></p><ol><li>The <strong>service</strong> wants to be used.</li><li>The <strong>client</strong> that uses the service.</li><li>An <strong>interface</strong> that defines how to used by the client and implemented by the service.</li><li>The <strong>injector</strong> which is responsible for constructing and injects it into the client.</li></ol><p><strong>Popular Library Dependency Injection for Android</strong></p><ul><li>RoboGuice</li><li>Dagger2</li><li>Koin</li><li>Kodein</li><li>etc.</li></ul><p><strong>Why use koin than dagger2 on kotlin?</strong></p><p><strong>Koin</strong> is a pragmatic lightweight dependency injection framework for Kotlin developers. It supports DSL (Design Structure Language) and functional programming.</p><p>What does <strong>koin</strong> offer?</p><ul><li>Small</li><li>Pragmatic</li><li>Concise</li><li>Support Android Architecture Component like database room, view model for MVVM</li></ul><p>What’s missing from <strong>koin</strong>?</p><ul><li>No code generation</li><li>No proxy classes</li><li>No introspection</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*itGBkWjJlj8bMMe4Y3B4vQ.png" /><figcaption><strong>Source: </strong><a href="https://www.slideshare.net/ssuser80beb5/koin-for-dependency-injection"><strong>Kirill Rozov</strong></a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*CBJgFvvY4Tp9PzT-mmlJvQ.png" /><figcaption><strong>Source: </strong><a href="https://www.nan-labs.com/blog/android-dependency-injection-moved-dagger-2-koin/"><strong>nan-labs</strong></a></figcaption></figure><p>For more detail documentation using the <a href="https://insert-koin.io/docs/1.0/getting-started/introduction/"><strong>koin</strong></a> dependency injection.</p><p><strong>Sample Project Dependency Injection with Koin (MVVM, Coroutines, Unit Testing)</strong></p><p><a href="https://github.com/rizqiaryansa/KoinCoroutinesSample">rizqiaryansa/KoinCoroutinesSample</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8102249c454b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>