<?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 Shibin on Medium]]></title>
        <description><![CDATA[Stories by Shibin on Medium]]></description>
        <link>https://medium.com/@shibin_sv?source=rss-4fbdb34a2c86------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*bEO_AHiwXyqnJCd3</url>
            <title>Stories by Shibin on Medium</title>
            <link>https://medium.com/@shibin_sv?source=rss-4fbdb34a2c86------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 19:50:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shibin_sv/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[Understanding Clean Architecture and Dependency Injection in Android by Building UserSpace]]></title>
            <link>https://medium.com/@shibin_sv/understanding-clean-architecture-and-dependency-injection-in-android-by-building-userspace-30904bd81984?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/30904bd81984</guid>
            <category><![CDATA[hilts]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 15:31:35 GMT</pubDate>
            <atom:updated>2026-10-05T15:31:35.309Z</atom:updated>
            <content:encoded><![CDATA[<h4>A practical, step-by-step approach to understanding why each layer exists, how dependencies flow, and how Hilt connects everything together.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZvB-4opAoKkL7r2YyEKow.png" /></figure><h3>Introduction</h3><p>Clean Architecture is one of those topics that sounds simple when you read about it:</p><ul><li>Domain</li><li>Data</li><li>Presentation</li><li>Repository</li><li>Use Case</li><li>Dependency Injection</li><li>ViewModel</li></ul><p>But when you actually start writing an Android application, things become less obvious.</p><p><strong>Where should this class go?</strong></p><p><strong>Should the repository be in the domain or data layer?</strong></p><p><strong>Why do I need an interface?</strong></p><p><strong>Why do I need a use case if it only calls one repository function?</strong></p><p><strong>What exactly is Hilt doing?</strong></p><p>I had the same questions.</p><p>So instead of trying to memorize a predefined Clean Architecture folder structure, I decided to build a small Android project called <strong>UserSpace</strong> and understand the architecture <strong>one concept at a time</strong>.</p><p>The goal isn’t to create a huge production application.</p><p>The goal is to understand <strong>why each class exists and how the classes work together.</strong></p><h3>What is UserSpace?</h3><p>UserSpace is a small Android project that I’m using to learn and practice:</p><ul><li>Kotlin</li><li>Jetpack Compose</li><li>Clean Architecture</li><li>Dependency Injection</li><li>Hilt</li><li>Coroutines</li><li>Flow / StateFlow</li><li>MVVM</li></ul><p>The project is intentionally being built incrementally.</p><p>Instead of starting with 50 folders and 100 classes, I started with one simple requirement:</p><blockquote><strong><em>Display a list of users.</em></strong></blockquote><p>From that simple requirement, the architecture gradually evolved.</p><h3>The Architecture We Are Building</h3><p>The basic flow looks like this:</p><pre>User Interface<br>      ↓<br>   ViewModel<br>      ↓<br>   Use Case<br>      ↓<br>  Repository<br>      ↓<br>  Data Source</pre><p>In our UserSpace project:</p><pre>UserListScreen<br>      ↓<br>UserViewModel<br>      ↓<br>GetUsersUseCase<br>      ↓<br>UserRepository<br>      ↓<br>UserRepositoryImpl<br>      ↓<br>UserDataSource</pre><p>At first, this might look like a lot of classes just to display some users.</p><p>And that’s exactly why I wanted to understand <strong>why they exist</strong>.</p><h3>1. Start With the Domain</h3><p>The first thing I created was the User model.</p><pre>data class User(<br>    val id: Int,<br>    val name: String,<br>    val email: String,<br>    val city: String<br>)</pre><p>This lives inside:</p><pre>features/users/domain/model/User.kt</pre><h3>Why Domain?</h3><p>The domain represents the actual business concepts of the application.</p><p>A user is a user whether the data comes from:</p><pre>REST API<br>Room<br>Firebase<br>Local JSON<br>Mock data</pre><p>The domain shouldn’t care about any of those technologies.</p><p>For example, our User model doesn&#39;t know anything about:</p><pre>Retrofit<br>Room<br>Firebase<br>Compose<br>Android Context<br>Hilt</pre><p>And that’s intentional.</p><h3>2. Create the Repository Contract</h3><p>Next, I created:</p><pre>interface UserRepository {<br>suspend fun getUsers(): List&lt;User&gt;<br>}</pre><p>This is located in:</p><pre>features/users/domain/repository/UserRepository.kt</pre><p>At first, the interface might seem unnecessary.</p><p>Why not simply create:</p><pre>class UserRepository {<br>    ...<br>}</pre><p>The reason is <strong>Dependency Inversion</strong>.</p><p>The domain shouldn’t depend on a specific implementation.</p><p>Instead, the domain says:</p><blockquote><em>“I need something that can provide users.”</em></blockquote><p>It doesn’t say:</p><blockquote><em>“I need Firebase.”</em></blockquote><p>or:</p><blockquote><em>“I need Retrofit.”</em></blockquote><p>or:</p><blockquote><em>“I need Room.”</em></blockquote><p>So we define a contract:</p><pre>UserRepository</pre><p>The implementation can come later.</p><h3>3. Implement the Repository</h3><p>Now we create the actual implementation.</p><pre>class UserRepositoryImpl @Inject constructor(<br>    private val userDataSource: UserDataSource<br>) : UserRepository {<br>override suspend fun getUsers(): List&lt;User&gt; {<br>        return userDataSource.getUsers()<br>    }<br>}</pre><p>This belongs in the data layer:</p><pre>features/users/data/repository/UserRepositoryImpl.kt</pre><p>Now we have:</p><pre>Domain<br>   ↓<br>UserRepository<br>   ↑<br>UserRepositoryImpl</pre><p>Notice something important.</p><p>The domain knows:</p><pre>UserRepository</pre><p>But the domain does <strong>not</strong> know:</p><pre>UserRepositoryImpl</pre><p>That’s one of the important ideas behind Clean Architecture.</p><h3>4. Introduce the Data Source</h3><p>Next comes the data source.</p><p>For now, I’m intentionally keeping it simple:</p><pre>class UserDataSource @Inject constructor() {<br>suspend fun getUsers(): List&lt;User&gt; {<br>        return listOf(<br>            User(<br>                id = 1,<br>                name = &quot;John Doe&quot;,<br>                email = &quot;john@gmail.com&quot;,<br>                city = &quot;Chennai&quot;<br>            ),<br>            User(<br>                id = 2,<br>                name = &quot;Sarah Smith&quot;,<br>                email = &quot;sarah@gmail.com&quot;,<br>                city = &quot;Bangalore&quot;<br>            ),<br>            User(<br>                id = 3,<br>                name = &quot;Alex Johnson&quot;,<br>                email = &quot;alex@gmail.com&quot;,<br>                city = &quot;Mumbai&quot;<br>            )<br>        )<br>    }<br>}</pre><p>The current data is hardcoded.</p><p>That’s okay.</p><p>The purpose at this stage isn’t to build a complete backend.</p><p>It’s to understand the responsibility of each layer.</p><p>Later, this data source could become:</p><pre>UserRemoteDataSource<br>       ↓<br>     Retrofit</pre><p>or:</p><pre>UserLocalDataSource<br>       ↓<br>      Room</pre><p>or even:</p><pre>FirebaseDataSource<br>       ↓<br>    Firestore</pre><p>The repository doesn’t need to change its contract.</p><h3>5. Why Do We Need a Use Case?</h3><p>Now we introduce:</p><pre>class GetUsersUseCase @Inject constructor(<br>    private val userRepository: UserRepository<br>) {<br>suspend operator fun invoke(): List&lt;User&gt; {<br>        return userRepository.getUsers()<br>    }<br>}</pre><p>At this point, you might ask:</p><blockquote><em>Why not call </em><em>UserRepository directly from the ViewModel?</em></blockquote><p>We could.</p><p>But a Use Case represents a <strong>business action</strong>.</p><p>For example:</p><pre>Get Users<br>Create User<br>Update User<br>Delete User<br>Login User<br>Register User</pre><p>Instead of:</p><pre>ViewModel → Repository</pre><p>we have:</p><pre>ViewModel → UseCase → Repository</pre><p>As the application grows, the use case can contain business rules without turning the ViewModel into a giant class.</p><p>For example:</p><pre>suspend operator fun invoke(): List&lt;User&gt; {<br>val users = userRepository.getUsers()<br>    return users<br>        .filter { it.name.isNotBlank() }<br>        .sortedBy { it.name }<br>}</pre><p>Now the business logic stays outside the UI.</p><h3>6. Dependency Injection Enters the Picture</h3><p>Now we have several classes depending on each other:</p><pre>GetUsersUseCase<br>        ↓<br>UserRepository<br>        ↓<br>UserRepositoryImpl<br>        ↓<br>UserDataSource</pre><p>Someone needs to create all these objects.</p><p>We could manually do:</p><pre>val dataSource = UserDataSource()<br>val repository = UserRepositoryImpl(dataSource)<br>val useCase = GetUsersUseCase(repository)</pre><p>But this becomes difficult as the application grows.</p><p>This is where <strong>Dependency Injection</strong> helps.</p><h3>7. What Does @Inject Actually Mean?</h3><p>Consider:</p><pre>class GetUsersUseCase @Inject constructor(<br>    private val userRepository: UserRepository<br>)</pre><p>The important part is:</p><pre>@Inject</pre><p>We’re telling Hilt:</p><blockquote><em>“Hilt, you are allowed to create this class, and these are the dependencies it needs.</em></blockquote><p>Similarly:</p><pre>class UserRepositoryImpl @Inject constructor(<br>    private val userDataSource: UserDataSource<br>)</pre><p>And:</p><pre>class UserDataSource @Inject constructor()</pre><p>Now Hilt can understand most of the dependency graph.</p><p>But there is still one problem.</p><h3>8. The Interface Problem</h3><p>Suppose Hilt sees:</p><pre>private val userRepository: UserRepository</pre><p>Hilt asks:</p><blockquote><em>Which implementation of </em><em>UserRepository should I create?</em></blockquote><p>We have:</p><pre>UserRepository<br>        ↑<br>UserRepositoryImpl</pre><p>But Hilt needs to be explicitly told about that relationship.</p><p>That’s where @Binds comes in.</p><h3>9. Understanding @Binds</h3><p>I created:</p><pre>features/users/data/di/UserRepositoryModule.kt</pre><p>with:</p><pre>@Module<br>@InstallIn(SingletonComponent::class)<br>abstract class UserRepositoryModule {<br>@Binds<br>    abstract fun bindUserRepository(<br>        implementation: UserRepositoryImpl<br>    ): UserRepository<br>}</pre><p>The important part is:</p><pre>@Binds<br>abstract fun bindUserRepository(<br>    implementation: UserRepositoryImpl<br>): UserRepository</pre><p>This essentially tells Hilt:</p><pre>When someone asks for:UserRepository<br>give them: UserRepositoryImpl</pre><p>So now Hilt knows the missing connection.</p><h3>10. Understanding @InstallIn</h3><p>We also have:</p><pre>@InstallIn(SingletonComponent::class)</pre><p>This answers a different question.</p><p>@InstallIn tells Hilt:</p><blockquote><strong><em>Where should this dependency binding live?</em></strong></blockquote><p>In this case:</p><pre>SingletonComponent</pre><p>means the binding is available at the application level.</p><p>It’s important not to confuse:</p><pre>@InstallIn</pre><p>with:</p><pre>@Singleton</pre><p>They solve different problems.</p><pre>@InstallIn<br>    ↓<br>Where the binding belongs<br>@Singleton<br>    ↓<br>How the instance is scoped/reused</pre><h3>11. Now We Have a Dependency Graph</h3><p>At this point, the architecture becomes much clearer:</p><pre>┌──────────────────────┐<br>│   UserListScreen     │<br>└──────────┬───────────┘<br>           ↓<br>┌──────────────────────┐<br>│    UserViewModel     │<br>└──────────┬───────────┘<br>           ↓<br>┌──────────────────────┐<br>│   GetUsersUseCase    │<br>└──────────┬───────────┘<br>           ↓<br>┌──────────────────────┐<br>│   UserRepository     │<br>│     interface        │<br>└──────────┬───────────┘<br>           ↓<br>┌──────────────────────┐<br>│ UserRepositoryImpl   │<br>└──────────┬───────────┘<br>           ↓<br>┌──────────────────────┐<br>│   UserDataSource     │<br>└──────────────────────┘</pre><p>Hilt resolves this graph automatically.</p><p>When Hilt needs:</p><pre>UserViewModel</pre><p>it follows the dependencies:</p><pre>UserViewModel<br>      ↓<br>GetUsersUseCase<br>      ↓<br>UserRepository<br>      ↓<br>UserRepositoryImpl<br>      ↓<br>UserDataSource</pre><p>And creates the required objects.</p><h3>12. Managing UI State</h3><p>Now we need to get the data into the UI.</p><p>Instead of exposing a raw list, I created a UI state:</p><pre>sealed interface UserListUiState {<br>data object Loading : UserListUiState<br>data class Success(val users: List&lt;User&gt;) : UserListUiState<br>data class Error(val message: String) : UserListUiState<br>}</pre><p>Why?</p><p>Because the UI doesn’t only have one state.</p><p>It can be:</p><pre>Loading<br>Success<br>Error</pre><p>This makes the UI state explicit.</p><h3>13. StateFlow in the ViewModel</h3><p>The ViewModel maintains that state:</p><pre>private val _uiState =<br>  MutableStateFlow&lt;UserListUiState&gt;(UserListUiState.Loading)<br>val uiState: StateFlow&lt;UserListUiState&gt; =<br>    _uiState.asStateFlow()</pre><p>The distinction is important.</p><p>The ViewModel owns:</p><pre>MutableStateFlow</pre><p>The UI receives:</p><pre>StateFlow</pre><p>So the UI can observe the state but cannot directly modify it.</p><h3>14. Loading Users</h3><p>The ViewModel calls the use case:</p><pre>fun loadUsers() {<br>  viewModelScope.launch {<br>        _uiState.value =<br>            UserListUiState.Loading<br>        try {<br>            val users = getUsersUseCase()<br>            _uiState.value =<br>                UserListUiState.Success(users)<br>        } catch (e: Exception) {<br>            _uiState.value =<br>                UserListUiState.Error(<br>                    e.message ?: &quot;Something went wrong&quot;<br>                )<br>        }<br>    }<br>}</pre><p>The flow is now:</p><pre>UI<br> ↓<br>ViewModel<br> ↓<br>UseCase<br> ↓<br>Repository<br> ↓<br>DataSource</pre><p>And the result travels back:</p><pre>DataSource<br> ↓<br>Repository<br> ↓<br>UseCase<br> ↓<br>ViewModel<br> ↓<br>StateFlow<br> ↓<br>UI</pre><h3>15. Compose Observes the State</h3><p>The Compose screen observes the StateFlow:</p><pre>val uiState by viewModel.uiState.collectAsState()</pre><p>Then:</p><pre>when (val state = uiState) {<br> is UserListUiState.Loading -&gt; {<br>        CircularProgressIndicator()<br>    }<br>  is UserListUiState.Success -&gt; {<br>        state.users.forEach { user -&gt;<br>            Text(<br>                text = &quot;${user.name} - ${user.email}&quot;<br>            )<br>        }<br>    }<br>    is UserListUiState.Error -&gt; {<br>        Text(<br>            text = state.message<br>        )<br>    }<br>}</pre><p>The UI doesn’t know:</p><ul><li>where the data came from</li><li>which repository was used</li><li>whether the data came from Room</li><li>whether it came from Retrofit</li><li>whether Firebase was involved</li></ul><p>It simply knows:</p><blockquote><em>“Here is my current UI state. Render it.”</em></blockquote><p>That’s a powerful separation.</p><h3>Clean Architecture Isn’t About Folders</h3><p>One of the biggest things I’m learning from this project is that Clean Architecture isn’t really about creating folders like:</p><pre>data<br>domain<br>presentation</pre><p>Those folders are just a way of organizing code.</p><p>The important part is the <strong>dependency direction</strong>.</p><p>For example:</p><pre>Presentation<br>      ↓<br>   Domain<br>      ↑<br>    Data</pre><p>The domain shouldn’t become dependent on Android frameworks or external data sources.</p><p>That’s much more important than whether your package is named:</p><pre>domain/</pre><p>or:</p><pre>business/</pre><h3>What I’ve Learned So Far</h3><p>Building the project step by step helped me understand several things that are easy to miss when simply reading tutorials.</p><h3>Repository ≠ Data Source</h3><p>The repository coordinates data access.</p><p>The data source is responsible for actually obtaining or storing data.</p><h3>Use Case ≠ Mandatory Wrapper</h3><p>A use case is valuable when it represents a meaningful application/business operation.</p><p>It shouldn’t exist just because:</p><blockquote><em>“Clean Architecture says every function needs a use case.”</em></blockquote><h3>@Inject ≠ @Binds</h3><p>They solve different problems.</p><pre>@Inject<br>→ Hilt knows how to construct a class<br>@Binds<br>→ Hilt knows which implementation to use for an interface</pre><h3>@InstallIn ≠ @Singleton</h3><p>Again, different responsibilities.</p><pre>@InstallIn<br>→ Where the binding lives<br>@Singleton<br>→ How the dependency is scoped</pre><h3>StateFlow Makes UI State Explicit</h3><p>Instead of the UI guessing what is happening, we explicitly represent:</p><pre>Loading<br>Success<br>Error</pre><p>This makes the UI easier to reason about.</p><h3>What’s Next?</h3><p>The current implementation uses a simple UserDataSource.</p><p>The next architectural challenge is separating different representations of the same data.</p><p>For example, an API might return:</p><pre>data class UserDto(<br>    val id: Int,<br>    val fullName: String,<br>    val emailAddress: String<br>)</pre><p>The database might have:</p><pre>@Entity<br>data class UserEntity(<br>    @PrimaryKey<br>    val id: Int,<br>    val name: String,<br>    val email: String<br>)</pre><p>But the domain might only need:</p><pre>data class User(<br>    val id: Int,<br>    val name: String,<br>    val email: String,<br>    val city: String<br>)</pre><p>This introduces another important concept:</p><pre>API<br> ↓<br>UserDto<br> ↓<br>Mapping<br> ↓<br>User<br> ↓<br>Domain</pre><p>and eventually:</p><pre>┌── Retrofit<br>                │<br>Repository ─────┤<br>                │<br>                └── Room</pre><p>That’s where Clean Architecture starts becoming much more interesting.</p><h3>Final Thoughts</h3><p>I’m building UserSpace with one simple rule:</p><blockquote><strong><em>Don’t just learn what a class is. Understand why it exists.</em></strong></blockquote><p>Instead of starting with a huge architecture template, I’m building the application one piece at a time.</p><p>The current journey looks like:</p><pre>Domain Model<br>     ↓<br>Repository Contract<br>     ↓<br>Repository Implementation<br>     ↓<br>Data Source<br>     ↓<br>Use Case<br>     ↓<br>Hilt Dependency Injection<br>     ↓<br>ViewModel<br>     ↓<br>StateFlow<br>     ↓<br>Compose UI</pre><p>And the most useful part isn’t the final folder structure.</p><p>It’s understanding the <strong>relationship between these components</strong>.</p><p>That’s what I’m hoping to continue exploring with UserSpace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30904bd81984" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevTap: A Tiny Android Tool I Built to Make Developer Settings One Tap Away]]></title>
            <link>https://medium.com/@shibin_sv/devtap-a-tiny-android-tool-i-built-to-make-developer-settings-one-tap-away-992cc4047d90?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/992cc4047d90</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-development]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 06:46:33 GMT</pubDate>
            <atom:updated>2026-09-04T06:47:36.953Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wN4DZbqFr6YWOToepH_Agw.png" /></figure><p>If you develop Android apps regularly, you probably visit <strong>Developer Options</strong> more often than you’d like to admit.</p><p>USB debugging.<br> Wireless debugging.<br> USB configuration.<br> Device information.<br> Screen details.<br> Battery information.</p><p>None of these things are particularly difficult to access. The annoying part is that they’re often buried several taps deep inside Android Settings.</p><p>So I decided to build a small utility for myself:</p><p><strong>DevTap.</strong></p><p>The idea is simple:</p><blockquote><strong><em>Put the Android developer settings and useful device information I frequently need behind a single, fast interface.</em></strong></blockquote><p>This is the beginning of that project.</p><h3>What is DevTap?</h3><p>DevTap is a lightweight Android developer utility designed to provide quick access to debugging settings and device information.</p><p>The first version focuses on a few things I frequently need while developing and debugging Android applications:</p><ul><li>USB Debugging</li><li>Wireless Debugging</li><li>Developer Options</li><li>USB Configuration</li><li>ADB status</li><li>Device information</li><li>Screen information</li><li>Battery information</li><li>Copying device information</li></ul><p>The goal isn’t to replace Android Settings.</p><p>It’s simply to reduce the number of steps required to get where I need to go.</p><h3>The Problem</h3><p>When developing Android applications, I often need to perform small tasks like:</p><pre>Enable USB Debugging<br>        ↓<br>Open Developer Options<br>        ↓<br>Find USB Debugging<br>        ↓<br>Enable it</pre><p>Or when working with wireless debugging:</p><pre>Settings<br>   ↓<br>Developer Options<br>   ↓<br>Wireless Debugging</pre><p>These aren’t complicated workflows.</p><p>But developers repeat them <strong>a lot</strong>.</p><p>And when you’re switching between devices, emulators, Android versions, and development environments, having quick access becomes surprisingly useful.</p><p>That’s where the idea for DevTap came from.</p><h3>Building DevTap</h3><p>Once I had the idea, I wanted to keep the first version simple.</p><p>I didn’t want to build another complicated developer dashboard with dozens of features. I wanted something I could open, immediately understand, and use without thinking.</p><p>So the home screen is built around a few simple sections: <strong>Debugging, Developer, and Device</strong>.</p><p>The debugging section gives a quick overview of the current state and provides shortcuts to the settings I use most. The device section brings together information that would otherwise require checking different places on the phone.</p><p>I also wanted the app to be useful beyond just opening settings. Being able to quickly see things like the Android version, SDK, device model, screen information, and battery status makes it a handy little companion when testing on different devices.</p><p>For the UI, I went with a <strong>dark, minimal design</strong>. Since this is a tool aimed at developers, I wanted it to feel more like a small developer utility than a traditional Android settings screen.</p><p>This is only the first version, though. There are already plenty of things I’d like to improve and add as I continue using it.</p><h3>DevTap in Action</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*CfZMKyrJGRSX3Jm4ILLlpA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*TOOORR9iSa12CmpEemgv4g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*9W5tbCXpSC8lUhV9vSIIbA.jpeg" /></figure><h3><strong>Final Thoughts</strong></h3><p>Sometimes the most useful developer tools aren’t complicated.</p><p>They’re the ones that remove a few annoying steps from something you do every day.</p><p>That’s what I’m hoping DevTap becomes.</p><p>A tiny app.</p><p>Open it.</p><p>Check the device.</p><p>See whether debugging is enabled.</p><p>Jump directly to the setting you need.</p><p>Copy the information.</p><p>Done.</p><p><strong>One tap closer to getting back to coding.</strong></p><h3>🔗 Source Code</h3><p>The project is open source on GitHub: <a href="https://github.com/shibinsv/devtap"><strong>DevTap — Android Developer Utility</strong></a></p><p><em>DevTap v0.1.0 — built with Kotlin, Jetpack Compose, Material 3, ViewModel and StateFlow.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=992cc4047d90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Building a Dynamic Android Launcher Icon Switcher with Firebase Firestore]]></title>
            <link>https://medium.com/@shibin_sv/building-a-dynamic-android-launcher-icon-switcher-with-firebase-firestore-e049e80898d4?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/e049e80898d4</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[dynamic-app-icon]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[app-icon]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Sun, 05 Jul 2026 16:02:02 GMT</pubDate>
            <atom:updated>2026-07-05T16:02:02.208Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How I built a remote launcher icon switching system while exploring Activity Aliases, PackageManager, and modern Android architecture.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZ9OCrgaXl6IsK5pnU0kEQ.png" /></figure><h3>Introduction</h3><p>There are times when you want your application’s launcher icon to change dynamically.</p><p>Imagine changing your app icon for:</p><ul><li>🎄 Christmas</li><li>🎃 Halloween</li><li>❤️ Valentine’s Day</li><li>🏆 Special promotions</li><li>🏢 White-label applications</li><li>🧪 A/B testing</li></ul><p>The interesting part?</p><p><strong>Without publishing a new APK.</strong></p><p>I wanted to understand how Android supports this feature and decided to build a personal project around it. Along the way, it became an opportunity to explore clean architecture, modular design, Firebase Firestore, and library design.</p><p>This article walks through that journey.</p><h3>The Problem</h3><p>Android launcher icons aren’t just images. They’re declared inside the Android Manifest.</p><p>At first glance, changing them at runtime seems impossible. But Android provides a lesser-known feature called <strong>Activity Aliases</strong>.</p><h3>Understanding Activity Aliases</h3><p>Instead of having a single launcher activity, Android allows multiple launcher aliases pointing to the same activity.</p><pre>&lt;activity<br>    android:name=&quot;.MainActivity&quot;<br>    android:exported=&quot;true&quot;/&gt;</pre><pre>&lt;activity-alias<br>    android:name=&quot;.BlueIcon&quot;<br>    android:targetActivity=&quot;.MainActivity&quot;<br>    android:icon=&quot;@mipmap/ic_launcher_blue&quot;&gt;</pre><pre>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;<br>        &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;<br>    &lt;/intent-filter&gt;</pre><pre>&lt;/activity-alias&gt;</pre><p>Every alias has its own launcher icon. The trick is enabling one alias while disabling the others.</p><h3>Switching Icons</h3><p>Android exposes this through PackageManager.</p><pre>packageManager.setComponentEnabledSetting(<br>    component,<br>    PackageManager.COMPONENT_ENABLED_STATE_ENABLED,<br>    PackageManager.DONT_KILL_APP<br>)</pre><p>That’s all it takes. Well…Not exactly.</p><h3>The First Challenge</h3><p>I quickly discovered that simply enabling another alias isn’t enough.Different launchers behave differently.</p><p>Some update instantly. Some delay the update. Some restart the application.</p><p>The Android Emulator even closes the running app while refreshing the launcher icon. That behavior comes from the launcher implementation rather than the switching code itself. Understanding that distinction saved me a lot of debugging time.</p><h3>Making It Remote</h3><p>Manually switching icons isn’t particularly exciting. I wanted the icon to change remotely. I chose Firebase Firestore because of its real-time listeners.</p><p>The Firestore structure is intentionally simple.</p><pre>configuration<br>    └── icon<br>         └── activeIcon = &quot;blue&quot;</pre><p>Changing one value updates every connected device.</p><h3>Project Architecture</h3><p>Rather than placing everything inside MainActivity, I built a small modular architecture.</p><pre>Firestore<br>      │<br>      ▼<br>Remote Provider<br>      │<br>      ▼<br>Repository<br>      │<br>      ▼<br>Alias Manager<br>      │<br>      ▼<br>PackageManager<br>      │<br>      ▼<br>Launcher Icon</pre><p>Every class has a single responsibility.</p><ul><li>Provider → receives remote updates</li><li>Repository → coordinates icon changes</li><li>Alias Manager → interacts with PackageManager</li><li>Preferences → stores current icon</li><li>Validator → verifies icon names</li></ul><h3>Designing the API</h3><p>As the project grew, I wanted initialization to remain clean.</p><p>Instead of:</p><pre>IconSwitcher.initialize(...)</pre><p>I moved to a Builder Pattern.</p><pre>IconSwitcher.builder(applicationContext)<br>    .config(config)<br>    .provider(<br>        FirestoreProvider(<br>            FirebaseFirestore.getInstance()<br>        )<br>    )<br>    .listener(listener)<br>    .build()</pre><p>The API became easier to read and extend.</p><h3>Building a Demo Dashboard</h3><p>I didn’t want a project that only worked in the background.</p><p>So I created a Jetpack Compose dashboard showing:</p><ul><li>Current launcher icon</li><li>Available icons</li></ul><p>This made debugging much easier while also serving as a showcase for the project.</p><h3>One Unexpected Lesson</h3><p>Initially I wanted to ask users for confirmation before applying remote icon updates.</p><p>After experimenting with the flow, I realized it introduced unnecessary friction.</p><p>More importantly, Firestore emits the current document immediately when a listener is attached, which meant the confirmation dialog appeared every time the app launched.</p><p>I eventually decided that automatic updates were the cleaner design for this project.</p><h3>Another Challenge</h3><p>One limitation I couldn’t completely avoid was launcher behavior.</p><p>Some launchers restart the application when the active launcher alias changes. This isn’t caused by the switching logic itself. It’s how certain launchers refresh their app shortcuts.</p><p>A better approach is to queue icon changes while the app is active and apply them when it moves to the background, although launcher behavior still varies across devices.</p><h3>Lessons Learned</h3><p>Working on this project helped me understand much more than launcher icons.</p><p>I also explored:</p><ul><li>Activity Aliases</li><li>PackageManager</li><li>Firebase Firestore listeners</li><li>Repository Pattern</li><li>Builder Pattern</li><li>StateFlow</li><li>Jetpack Compose</li><li>Modular Android architecture</li><li>API design</li></ul><p>A small feature became a valuable learning exercise.</p><h3>What’s Next?</h3><p>I plan to continue evolving the project by adding:</p><ul><li>Additional remote providers</li><li>Lifecycle-aware updates</li><li>Improved logging</li><li>Better Compose dashboard</li><li>Unit tests</li><li>Eventually publishing it as a reusable Android library</li></ul><h3>Final Thoughts</h3><p>This project started as a simple experiment.</p><p>It ended up teaching me far more than I expected.</p><p>Sometimes the most interesting learning comes from exploring a single Android API in depth rather than building another full application.</p><p>If you’re looking for a project to strengthen your Android fundamentals while experimenting with architecture and remote configuration, dynamic launcher icons are an excellent place to start.</p><h3>Source Code</h3><p>The complete project is available on GitHub.</p><p><a href="https://github.com/shibinsv/android-icon-switcher">GitHub - shibinsv/android-icon-switcher</a></p><h3>Connect</h3><p>If you enjoyed this article or have suggestions for improving the project, I’d love to hear your thoughts.</p><p>Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e049e80898d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building AI Agents in Android with MCP: From Chatbots to Real-World Actions]]></title>
            <link>https://medium.com/@shibin_sv/building-ai-agents-in-android-with-mcp-from-chatbots-to-real-world-actions-9e82aea3f710?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e82aea3f710</guid>
            <category><![CDATA[on-device]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 14:48:31 GMT</pubDate>
            <atom:updated>2026-07-01T14:48:31.887Z</atom:updated>
            <content:encoded><![CDATA[<p>Large Language Models (LLMs) are incredibly good at reasoning and answering questions. But ask them to perform real-world tasks — schedule a meeting, book a cab, or update your database — and they quickly hit a wall.</p><p>The missing piece isn’t intelligence. It’s the ability to <strong>take action</strong>.</p><p>That’s where <strong>AI Agents</strong> and the <strong>Model Context Protocol (MCP)</strong> come in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEGH3qkj53755TRdoGeqVw.png" /></figure><h3>What is an AI Agent?</h3><p>An AI Agent is much more than a chatbot. It combines three essential components:</p><ul><li><strong>A Brain</strong> — an LLM such as Gemini, GPT, Claude, or Gemma.</li><li><strong>Tools</strong> — APIs and services the model can invoke.</li><li><strong>A Loop</strong> — the ability to reason, execute actions, observe results, and continue until the task is complete.</li></ul><p>Instead of simply answering questions, an agent can:</p><ul><li>Search live information</li><li>Read private user data</li><li>Update databases</li><li>Book services</li><li>Perform multiple actions autonomously</li></ul><p>The model decides <em>what</em> needs to be done, while your application executes those decisions.</p><h3>The Problem MCP Solves</h3><p>Without MCP, every AI model requires custom integration with every external service.</p><p>If you have:</p><ul><li>5 AI models</li><li>10 APIs</li></ul><p>you end up maintaining <strong>50 integrations</strong>.</p><p>MCP transforms this into a much simpler model:</p><ul><li>Every model implements MCP once.</li><li>Every tool exposes itself through MCP once.</li></ul><p>Any compliant model can now work with any compliant tool.</p><p>Think of MCP as <strong>USB-C for AI</strong> — a universal connector between models and external systems.</p><h3>MCP Architecture</h3><p>MCP is built around three roles:</p><ul><li><strong>Host</strong> — Your Android application.</li><li><strong>Client</strong> — The MCP client embedded inside the app.</li><li><strong>Server</strong> — A service exposing capabilities through MCP.</li></ul><p>Servers expose three primary primitives:</p><ul><li><strong>Tools</strong> — Perform actions.</li><li><strong>Resources</strong> — Read data.</li><li><strong>Prompts</strong> — Reusable prompt templates.</li></ul><p>Communication happens using <strong>JSON-RPC</strong>, making the protocol portable across languages and platforms.</p><h3>Where Android Fits</h3><p>For Android developers:</p><ul><li>Your app acts as the <strong>Host</strong>.</li><li>The official <strong>Kotlin MCP SDK</strong> provides the Client.</li><li>Most communication happens over <strong>Streamable HTTP</strong> with remote MCP servers.</li></ul><p>The overall architecture becomes:</p><pre>Android App<br>     │<br>     ▼<br>   LLM (Gemini/Gemma)<br>     │<br>     ▼<br>  MCP Client<br>     │<br>     ▼<br> MCP Servers<br>     │<br>     ├── Weather API<br>     ├── Calendar<br>     ├── Payments<br>     ├── Internal Backend<br>     └── Any External Service</pre><h3>The Agent Loop</h3><p>Every AI agent follows the same reasoning cycle:</p><ol><li>Discover available tools.</li><li>Send tool definitions to the LLM.</li><li>Receive the user’s request.</li><li>Let the LLM decide which tools to use.</li><li>Execute the requested tools through MCP.</li><li>Feed the results back into the model.</li><li>Repeat until the model produces a final answer.</li></ol><p>This iterative reasoning loop is what separates an agent from a traditional chatbot.</p><h3>Building an MCP Client in Kotlin</h3><p>Using the official Kotlin SDK, implementing an agent requires only three core operations:</p><ul><li>Connect to an MCP server.</li><li>Discover available tools.</li><li>Execute tool calls.</li></ul><p>Once those pieces exist, your own agent loop orchestrates everything else.</p><p>The LLM performs the planning.</p><p>Your application simply executes the requested actions and returns the results.</p><h3>A Real Example</h3><p>Imagine a travel assistant.</p><p>The user says:</p><blockquote><em>“Find me a morning flight to Goa next Friday, check if it will rain, and save everything to my itinerary.”</em></blockquote><p>The agent automatically:</p><ul><li>Searches available flights.</li><li>Retrieves the weather forecast.</li><li>Chooses an appropriate flight.</li><li>Saves the itinerary.</li><li>Returns a natural-language response.</li></ul><p>The entire workflow happens from a single user request without hardcoding the sequence of API calls.</p><h3>Security Matters</h3><p>Because agents can modify user data, security is critical.</p><p>Production applications should always include:</p><ul><li>Human confirmation for sensitive actions.</li><li>OAuth-based authentication.</li><li>Trusted MCP servers only.</li><li>Validation of tool inputs and outputs.</li><li>Lifecycle-aware execution.</li><li>Bounded agent loops to prevent runaway execution.</li></ul><p>An intelligent agent is only useful if it is also safe.</p><h3>The Future: On-Device AI</h3><p>Cloud models are powerful, but on-device models like <strong>Gemma</strong> enable:</p><ul><li>Offline execution</li><li>Better privacy</li><li>Lower latency</li><li>No per-token cloud cost</li></ul><p>The best part?</p><p>Your MCP integrations remain exactly the same.</p><p>Only the “brain” changes.</p><p>This makes MCP a future-proof architecture regardless of which LLM powers your application.</p><h3>Final Thoughts</h3><p>The biggest mindset shift is this:</p><p>You’re no longer writing applications that manually orchestrate every API call.</p><p>Instead, you’re building a toolbox and allowing an AI model to decide <strong>which tools to use, in what order, and when</strong>.</p><p>Your responsibility becomes:</p><ul><li>Build reliable tools.</li><li>Expose them through MCP.</li><li>Execute them securely.</li><li>Let the LLM handle the reasoning.</li></ul><p>That’s what transforms a chatbot into an intelligent AI agent.</p><p>And that’s why MCP is quickly becoming the standard foundation for AI-powered applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vKEDsHUrtSTq-Vo05YSv6Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e82aea3f710" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to Hilt: Clean Dependency Injection in Android Explained]]></title>
            <link>https://medium.com/@shibin_sv/from-zero-to-hilt-clean-dependency-injection-in-android-explained-c9f26c6af3ca?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f26c6af3ca</guid>
            <category><![CDATA[dependency-injection]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[hilts]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 06:17:26 GMT</pubDate>
            <atom:updated>2026-03-28T06:17:26.734Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have ever worked with Android dependencies or passed objects through several layers, you know how messy things can get in a hurry.</p><p>I know from experience. When I first started developing Android apps, I thought it was easy to create objects manually.<br>But as the app grew, so did the mess. I had tight coupling, boilerplate code, and code that was harder to test than to write.</p><p>And then I stumbled upon Hilt. Game. Changer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obo4F3qL7BzIOZmdqAaTuA.png" /></figure><h3>🧠 What is Hilt?</h3><p><strong>Hilt is a dependency injection library for Android built on top of Dagger.</strong></p><p>It helps you manage how objects are created and shared across your app — without writing a lot of boilerplate code.</p><h3>🤔 Why do we even need Hilt?</h3><p>In a typical Android app, you often:</p><ul><li>Create objects manually (repositories, APIs, databases)</li><li>Pass them through multiple layers</li><li>Handle lifecycle yourself</li></ul><p>As your app grows, this becomes:</p><ul><li>Hard to maintain ❌</li><li>Hard to test ❌</li><li>Easy to break ❌</li></ul><h3>🧩 Simple Analogy</h3><p>Think of Hilt like a <strong>smart delivery system</strong>.</p><p>Instead of building and carrying objects everywhere, you simply:</p><p><em>“Ask for what you need”</em>…and Hilt delivers it at the right time.</p><h3>⚙️ Step 1: Adding Hilt to Your Project</h3><p>In your <strong>project-level </strong><strong>build.gradle</strong>:</p><pre>plugins {<br>    alias(libs.plugins.android.application) apply false<br>    alias(libs.plugins.android.library) apply false<br>    alias(libs.plugins.kotlin.android) apply false<br>    alias(libs.plugins.kotlin.compose) apply false<br>    alias(libs.plugins.hilt) apply false<br>    alias(libs.plugins.ksp) apply false<br>}</pre><p>In your <strong>app-level </strong><strong>build.gradle</strong>:</p><pre>plugins {<br>    alias(libs.plugins.android.application)<br>    alias(libs.plugins.kotlin.compose)<br>    alias(libs.plugins.hilt)<br>    alias(libs.plugins.ksp)<br>}<br><br>dependencies {<br>    implementation(libs.hilt.android)<br>    ksp(libs.hilt.compiler)<br>    implementation(libs.androidx.hilt.navigation.compose)<br>}</pre><h3>libs.versions.toml</h3><pre>[versions]<br>hilt = &quot;2.59.2&quot;<br>ksp = &quot;2.0.21-1.0.27&quot;<br><br>[libraries]<br>hilt-android = { module = &quot;com.google.dagger:hilt-android&quot;, version.ref = &quot;hilt&quot; }<br>hilt-compiler = { module = &quot;com.google.dagger:hilt-compiler&quot;, version.ref = &quot;hilt&quot; }<br><br>[plugins]<br>hilt = { id = &quot;com.google.dagger.hilt.android&quot;, version.ref = &quot;hilt&quot; }<br>ksp = { id = &quot;com.google.devtools.ksp&quot;, version.ref = &quot;ksp&quot; }</pre><p>With the setup complete, the next step is to <strong>initialize Hilt in our application class</strong>, which acts as the entry point for dependency injection.</p><h3>🧩 Step 2: Initialize Hilt in Application Class</h3><pre>@HiltAndroidApp<br>class MyApp : Application()</pre><h3>💡 Why this matters</h3><ul><li>Initializes Hilt</li><li>Creates the dependency graph</li><li>Required entry point for injection</li></ul><h3>Don’t forget in AndroidManifest.xml:</h3><pre>&lt;application<br>    android:name=&quot;.MyApp&quot;<br>    ... &gt;<br>&lt;/application&gt;</pre><h3>🚪 Step 3: Enable Injection in Android Components</h3><p><em>Now that Hilt is set up, we need to tell it </em><strong><em>where</em></strong><em> dependencies can be injected — like Activities, Fragments, etc.</em></p><h3>📍 Add @AndroidEntryPoint to Your Activity</h3><pre>@AndroidEntryPoint<br>class MainActivity : AppCompatActivity() {<br>    // We’ll inject dependencies here next 👀<br>}</pre><h3>💡 What this does</h3><ul><li>Enables dependency injection in Android components</li><li>Connects Activity to Hilt</li></ul><h3>🧪 Step 4: Create Your First Dependency</h3><pre>class UserRepository @Inject constructor() {<br>fun getUserName(): String {<br> return &quot;Jane Doe&quot;<br> }<br>}</pre><h3>💡 What’s happening here?</h3><blockquote><em>The </em><em>@Inject annotation tells Hilt: “Hey, you can create an instance of this class whenever it’s needed.”</em></blockquote><ul><li>Hilt now knows <strong>how to construct </strong><strong>UserRepository</strong></li><li>No need to manually create it using UserRepository()</li><li>This works as long as all dependencies inside it are also known to Hilt</li></ul><h3>💉 Step 5: Injecting the Dependency</h3><pre>@AndroidEntryPoint<br>class MainActivity : AppCompatActivity() {<br><br>    @Inject lateinit var userRepository: UserRepository<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br><br>        println(userRepository.getUserName())<br>    }<br>}</pre><h3>💡 What’s happening here?</h3><blockquote><em>The </em><em>@Inject keyword tells Hilt: “Give me an instance of </em><em>UserRepository here.”</em></blockquote><ul><li>No manual creation (UserRepository()) needed</li><li>Hilt automatically provides the instance</li></ul><h3>🧠 Step 6: Using Hilt with ViewModel</h3><blockquote><em>In real-world Android apps, most of your logic lives inside ViewModels.<br> So let’s see how Hilt helps inject dependencies there cleanly.</em></blockquote><pre>@HiltViewModel<br>class MainViewModel @Inject constructor(<br>    private val userRepository: UserRepository<br>) : ViewModel() {<br><br>    fun getUserName(): String {<br>        return userRepository.getUserName()<br>    }<br>}</pre><pre>private val viewModel: MainViewModel by viewModels()</pre><p>👉 No factory, no boilerplate — just clean injection.</p><h3>🧩 Step 7: Using Modules (@Module, @Provides)</h3><p>Use this when Hilt <strong>cannot create objects automatically</strong>.</p><pre>@Module<br>@InstallIn(SingletonComponent::class)<br>object AppModule {<br><br>    @Provides<br>    fun provideUserRepository(): UserRepository {<br>        return UserRepository()<br>    }<br>}</pre><h4>🧠 When to use Modules?</h4><ul><li>Retrofit</li><li>Room Database</li><li>Third-party libraries</li></ul><p>🔁 Real-world example (Retrofit style)</p><pre>@Provides<br>fun provideApiService(): ApiService {<br>    return Retrofit.Builder()<br>        .baseUrl(&quot;https://example.com&quot;)<br>        .build()<br>        .create(ApiService::class.java)<br>}</pre><h3>🚀 Final Thoughts</h3><p>With Hilt in place, you’ve taken a big step toward building a clean and scalable Android architecture.</p><p>No more:</p><ul><li>Manual object creation</li><li>Passing dependencies everywhere</li><li>Confusing initialization logic</li></ul><blockquote><em>Hilt quietly handles all of it — so you can focus on building features, not wiring objects.</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f26c6af3ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From $2 to Millions: Building an Android Explain App with DeepSeek API]]></title>
            <link>https://medium.com/@shibin_sv/from-2-to-millions-building-an-android-explain-app-with-deepseek-api-9d7e223cc831?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d7e223cc831</guid>
            <category><![CDATA[deepseek]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 14:25:39 GMT</pubDate>
            <atom:updated>2026-07-05T16:13:43.951Z</atom:updated>
            <content:encoded><![CDATA[<p>Every parent knows the moment. You’re cooking dinner, tired from work, when suddenly: <em>“Why is the sky blue?”</em> You take a breath and start explaining. Then: <em>“Who is the PM of India?”</em> Then: <em>“What is gravity?”</em> Then: <em>“How do fish breathe?”</em> The questions never stop — and honestly, that curiosity is beautiful. But here’s the problem: kids don’t just ask once. They ask the exact same questions tomorrow, next week, and next month. I tried using AI apps, but at $0.002 per answer, 50 daily questions would cost me $36/month — for just ONE child. I needed something smarter. So I built my own “Explain Like I’m 10” app using DeepSeek API, and somehow made $2 stretch to millions of explanations. Here’s exactly how.</p><p><strong>So let me start the journey I followed to guide you as well</strong></p><h3>STEP 1: Create Your Account</h3><p>Go to <a href="https://platform.deepseek.com/">platform.deepseek.com</a> and click “Sign Up.” Use your email — takes 30 seconds.</p><p>Bonus: New accounts get 5 million free tokens automatically. Enough for thousands of test calls without spending anything.</p><h3>STEP 2: Get Your API Key</h3><p>Once logged in:</p><ul><li>Click on “API Keys” in the left menu</li><li>Click “Create new API key”</li><li>Give it a name (like “explain-app”)</li><li>Copy the key immediately and save it somewhere safe</li></ul><h3>STEP 3: Created my android application (Basic)</h3><p>I opened Android Studio and created a new project with an Empty Views Activity.</p><p>Using Jetpack Compose I created an sample input view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*Yipb9Kg7zvea1Vl-eNnsWw.png" /></figure><h3>STEP 4: Advanced DeepSeek Integration in Android</h3><p>Now for the real magic — connecting our simple app to DeepSeek API. Here’s how I set it up:</p><h3>Adding Dependencies</h3><p>In app/build.gradle.kts:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebvZpKCcSoWuS2VT5rRPuw.png" /></figure><h3>Building the API Service</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJWNOnn97vP7irbln5XOng.png" /></figure><h3>Creating the Repository</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-bh1wxWPd5auJw6lBhks2g.png" /></figure><h3>Connecting to MainActivity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wyUHKODoVshoJ-F-uAFemg.png" /></figure><h3>API Call Structure</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4P62aMwpNtQC9J2y99ogKQ.png" /></figure><h3>API Key Storage in local.properties</h3><p>In local.properties (root level):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ACDQ-_IG1snJn9kG8UWAw.png" /></figure><p>Important: Added local.properties to .gitignore so API keys never get committed!</p><h3>Loading API Key in build.gradle.kts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cet2b16sY7LbYBgKY81kjQ.png" /></figure><h3>Using the Key in Code</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KmHKc-ab3A0S4gf67BHPw.png" /></figure><h3>ADDITIONAL STEP: Making Your Integration Production-Ready</h3><p><em>Error Handling — Try-catch blocks for network failures and API errors</em></p><p><em>Loading States — Progress indicator while waiting for response</em></p><p><em>Input Validation — Check for empty questions before calling API</em></p><p><em>Timeout Config — 30-second connect/read timeouts in OkHttp</em></p><p><em>API Key Security — Stored in BuildConfig, not hardcoded</em></p><p><em>User Feedback — Toast messages for errors and empty inputs</em></p><p><strong>🔗 SEE IT IN ACTION</strong></p><p>Before I explain why I chose DeepSeek over other models, here&#39;s the working app:<br><br>📱 GitHub Repository<br><a href="https://github.com/shibinsv/Explain_It">https://github.com/yourusername/explain-like-im-10</a><br>(Fully open-source code for you to explore)</p><p><strong>Why Deepseek and not others?</strong></p><p>Before building my “Explain Like I’m 10” app, I compared every major AI model. OpenAI’s GPT-4.1 cost $0.0008 per explanation, Claude was $0.0025, and even Gemini ran $0.0009. But DeepSeek? Just $0.00012 per answer. At first I thought Llama 4 was even cheaper, but it required complicated self-hosting. Then I found the feature that broke the bank — in a good way. DeepSeek offers context caching: send the same system message repeatedly, and they remember it, giving you 90% off on those parts. For an app where every question starts with “Explain like I’m 10,” this meant my $2 would stretch so far it might never run out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d7e223cc831" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Android App with Dialogflow CX: Here’s How]]></title>
            <link>https://medium.com/@shibin_sv/integrating-dialogflow-cx-with-android-93b0b17110af?source=rss-4fbdb34a2c86------2</link>
            <guid isPermaLink="false">https://medium.com/p/93b0b17110af</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[dialogflow]]></category>
            <category><![CDATA[android-development]]></category>
            <dc:creator><![CDATA[Shibin]]></dc:creator>
            <pubDate>Sat, 01 Mar 2025 04:46:11 GMT</pubDate>
            <atom:updated>2026-03-12T13:52:14.465Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello all,<br>This post discusses implementing a Dialogflow CX agent into an Android app in Kotlin.</p><p>I had the thrilling chance to implement my mobile app with the Gemini AI to provide responses from Firebase Firestore data.</p><p>When I embarked on integrating Dialogflow and using its agent’s features, I could find a lot of resources for web applications but hardly any for mobile apps. Therefore, I had to conduct a lot of research and testing to get it done. I’m creating this blog to make it easier for fellow mobile developers.</p><p>First things first, we need to integrate our Firebase database and generate a service.json file for integration. Please follow the steps in this video to obtain the service.json file.<br>Here is the link to the video: <a href="https://www.youtube.com/watch?v=dj9fxiuz4WM"><em>Generate service account key in Google Cloud Platform (GCP)</em></a>.</p><p>While updating roles in that , make sure to add <strong>Dialogflow API Client</strong> and <strong>Service Account User</strong>.</p><p>Next, we need to create a Dialogflow CX agent, as demonstrated in the video, and configure it with the required data. This data will be passed as a file in Datastore to ensure proper communication between the agent and the application. You can follow the step-by-step process in this video: <a href="https://www.youtube.com/watch?v=xdt41_MN4Zg">Datastore Integration — Google Dialogflow CX Generative AI</a>.</p><p>Once these steps are completed, the focus shifts to the application side, where we integrate and configure the necessary components for seamless communication with Dialogflow CX.</p><p><strong>Step 1:</strong> Add the necessary dependencies.</p><pre>implementation(&quot;com.google.cloud:google-cloud-dialogflow-cx:0.28.0&quot;)<br>implementation (&quot;io.grpc:grpc-okhttp:1.54.0&quot;)<br>implementation (&quot;io.grpc:grpc-protobuf:1.54.0&quot;)<br>implementation (&quot;io.grpc:grpc-stub:1.54.0&quot;)<br>implementation (&quot;io.grpc:grpc-netty-shaded:1.54.0&quot;)</pre><p><strong>Step 2:</strong> Add the necessary details from the Dialogflow CX Console to your Constants object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TtK4ZDnQrCv2BiOaV3DawA.png" /></figure><p><strong>Step 3:</strong> Place the service.json file inside the <strong>assets</strong> folder of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LihPK-hHOzk9Gi4EaLYaNw.png" /></figure><p><em>Note:</em> This method is recommended for testing purposes only. For production-level applications, embedding the file directly in the app is not advised due to security concerns.</p><p><strong>Step 4:</strong> Copy and implement the following piece of code to integrate Dialogflow into your Android application. This code will establish a connection between your app and the Dialogflow CX agent, enabling seamless interaction and response handling.</p><pre>fun getMessage(context: Context, prompt: String): String {<br>    return try {<br>        // Retrieve Google authentication credentials from the service.json file<br>        val inputStream = context.assets.open(&quot;service.json&quot;)<br>        val credentials = GoogleCredentials.fromStream(inputStream)<br><br>        // Configure Dialogflow CX session settings with authentication credentials<br>        val settings = SessionsSettings.newBuilder()<br>            .setCredentialsProvider(FixedCredentialsProvider.create(credentials))<br>            .build()<br><br>        // Create a SessionsClient instance to communicate with Dialogflow CX<br>        val sessionsClient = SessionsClient.create(settings)<br><br>        // Generate a unique session ID for this conversation<br>        val sessionId = UUID.randomUUID().toString()<br><br>        // Define the session name using project-specific constants<br>        val session = SessionName.of(<br>            Constants.PROJECT_ID,  // Google Cloud project ID<br>            Constants.LOCATION,    // Region where the Dialogflow agent is deployed<br>            Constants.AGENT_ID,    // Unique ID of the Dialogflow CX agent<br>            sessionId              // Unique session ID for conversation tracking<br>        )<br><br>        // Prepare the user input text<br>        val textInput = TextInput.newBuilder().setText(prompt).build()<br><br>        // Construct a query input object with the user text and language code<br>        val queryInput = QueryInput.newBuilder()<br>            .setText(textInput)<br>            .setLanguageCode(&quot;EN&quot;)  // Set language to English<br>            .build()<br><br>        // Create a request to send the user query to Dialogflow CX<br>        val detectIntentRequest = DetectIntentRequest.newBuilder()<br>            .setSession(session.toString())  // Attach the session to maintain context<br>            .setQueryInput(queryInput)       // Include the user&#39;s query<br>            .build()<br><br>        // Send the request and receive a response from Dialogflow CX<br>        val response = sessionsClient.detectIntent(detectIntentRequest)<br><br>        // Close the SessionsClient to free up resources<br>        sessionsClient.close()<br><br>        // Extract the first text response from the Dialogflow agent&#39;s response messages<br>        val responseText = response.queryResult.responseMessagesList.first().text.getText(0)<br><br>        // Return the agent&#39;s response as a string<br>        responseText<br>    } catch (e: Exception) {<br>        // Handle any exceptions and print the error message<br>        println(e.message)<br>        &quot;&quot;<br>    }<br>}</pre><p>Applying these steps in the application gives a simple means of getting a response if the given information is accurate.<br>I have left a sample application here in the repository for your reference:<br><a href="https://github.com/shibinsv/Ask-Me">https://github.com/shibinsv/Ask-Me</a>.</p><p>Go ahead and take a look. Happy coding! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93b0b17110af" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>