<?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 Abhishek Dubey on Medium]]></title>
        <description><![CDATA[Stories by Abhishek Dubey on Medium]]></description>
        <link>https://medium.com/@abhishekdubey331?source=rss-d850eac64a37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cyiOPh8j4lIE8MSXX62f-A.jpeg</url>
            <title>Stories by Abhishek Dubey on Medium</title>
            <link>https://medium.com/@abhishekdubey331?source=rss-d850eac64a37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:12:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishekdubey331/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[Claude Code Leaked. But That’s Not the Real Story.]]></title>
            <link>https://medium.com/@abhishekdubey331/claude-code-leaked-but-thats-not-the-real-story-4397cb61aa03?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/4397cb61aa03</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 20:59:17 GMT</pubDate>
            <atom:updated>2026-03-31T20:59:17.570Z</atom:updated>
            <content:encoded><![CDATA[<p>On March 31, 2026, reports began circulating that Anthropic’s Claude Code had exposed readable internal code through a published source map tied to its npm package. Within hours, developers on X, GitHub, and YouTube were picking through the leak, sharing screenshots, naming internal features, and speculating about what Anthropic had accidentally revealed.</p><p>The reaction was predictable. Embarrassing.<br>Basic security miss.<br>How does a company like this let that happen?</p><p>All fair.</p><p>But also not the most important part of the story.</p><p>Because this is not just a story about a leak. It is a story about what the leaked code appears to show Anthropic is actively building toward. And if those code paths, feature flags, and internal systems are representative, then Claude Code is moving toward something much bigger than a prompt-response coding assistant.</p><p>It is moving toward an always-on software system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TD_sRO5mZxKkqtSfNTDeqA.png" /><figcaption>claude</figcaption></figure><h3>What actually leaked?</h3><p>At the simplest level, the leak appears to have exposed readable portions of Claude Code’s internal implementation through a source map published alongside the npm package.</p><p>That reportedly gave outside observers visibility into parts of the tool’s internal code, including:</p><ul><li>implementation details,</li><li>feature flags,</li><li>internal prompts and workflows,</li><li>and references to systems that are not publicly documented.</li></ul><p>That does not mean every rumor now circulating online is true.</p><p>Internal code is not a product announcement. It contains experiments, unused branches, unfinished features, dead ends, and internal scaffolding that may never ship. So the right way to read a leak like this is not as a finalized roadmap.</p><p>It is a directional signal.</p><p>And the direction visible in this code is hard to ignore.</p><h3>The most important shift: coding agents are becoming always-on</h3><p>For the last few years, AI coding tools have mostly followed a simple loop.</p><p>You ask.<br>The model responds.<br>You refine.<br>You ask again.</p><p>Useful, yes. But still reactive.</p><p>What makes this leak interesting is that several of the reported code references point toward a different model entirely: persistent agents that observe, monitor, and act in the background.</p><p>Depending on which leaked references prove meaningful, that includes things like:</p><ul><li>periodic task cycles,</li><li>sleep and wake behavior,</li><li>background observation logs,</li><li>proactive issue detection,</li><li>and agent-driven follow-up actions.</li></ul><p>That is not just a better assistant. It is a different interaction model.</p><p>Instead of opening your editor and asking, “Can you help me figure out what broke?”, you open it and see:</p><ul><li>failing tests already analyzed,</li><li>suspicious changes already flagged,</li><li>fixes already proposed,</li><li>or a summary of what the agent inspected while you were away.</li></ul><p>That is the real shift.</p><p>Not better autocomplete.<br>Not faster answers.<br>A system that begins helping before you ask for help.</p><p>If the leaked code is any indication, Anthropic is not merely trying to make Claude Code more capable inside a session. It appears to be exploring how to make it persistent outside the session.</p><p>That matters much more than the leak itself.</p><h3>The second shift: deep work becomes a product feature</h3><p>Another recurring theme in the leak discussions is a planning mode often referred to as “Ultra Plan.”</p><p>The exact name may change. Internal naming is never the point. What matters is the architecture implied by the code.</p><p>The idea appears to be that certain tasks can be sent away for longer-running planning rather than handled in the usual rapid prompt-response loop. Instead of walking the AI through a complex problem step by step, the system can take the task, spend meaningful time on it, and return with a structured plan.</p><p>That is a subtle but important change.</p><p>Today’s AI coding experiences are usually optimized for speed. Ask a question, get an answer in seconds, keep moving.</p><p>But the highest-value engineering work is often not fast. It is slow, structural, and full of tradeoffs:</p><ul><li>service decomposition,</li><li>migrations,</li><li>database redesign,</li><li>interface boundaries,</li><li>architecture planning.</li></ul><p>If AI tools begin explicitly supporting long-running, higher-depth planning, the interaction model changes again.</p><p>You stop treating the tool like a search interface.<br>You start treating it like an asynchronous collaborator.</p><p>That matters because once planning becomes asynchronous, execution can too.</p><h3>Memory is becoming infrastructure</h3><p>The most important pattern in the leaked code may be memory.</p><p>Not lightweight consumer-chat memory. Not “remember my preferences” memory. Real working memory: project context, durable decisions, consolidated knowledge, and systems for maintaining that context over time.</p><p>Some of the leaked references reportedly point to memory flows designed to:</p><ul><li>gather observations across sessions,</li><li>merge duplicate context,</li><li>prune stale information,</li><li>and preserve what still matters.</li></ul><p>This is a much bigger deal than it sounds.</p><p>Anyone who uses AI coding tools seriously already knows the core limitation of the current generation:</p><ul><li>context gets bloated,</li><li>sessions become inconsistent,</li><li>decisions disappear,</li><li>useful history fragments,</li><li>and yesterday’s insight becomes today’s forgotten prompt.</li></ul><p>That is not primarily an intelligence problem.<br>It is a continuity problem.</p><p>If memory becomes self-maintaining, then every session stops being a fresh start.</p><p>The system can retain:</p><ul><li>why a decision was made,</li><li>which tradeoffs were already explored,</li><li>what conventions the codebase follows,</li><li>and what patterns are worth preserving.</li></ul><p>That compounds over time.</p><p>This is the kind of shift that turns an AI tool from stateless utility into working system. And if the leaked memory-consolidation logic is real and representative, Anthropic understands that clearly.</p><p>The future of coding agents may depend less on making them smarter in isolation and more on making their context more durable.</p><h3>Multi-agent coordination appears to be moving from novelty to architecture</h3><p>Another thing the leak seems to suggest is that Anthropic is thinking beyond the single-agent model.</p><p>There are references in some summaries to coordinator systems, sub-agent orchestration, verification workers, and task-specific delegation. Whether every implementation detail survives to release is almost secondary. The important signal is architectural.</p><p>The agent is no longer imagined as one monolithic assistant doing everything itself.</p><p>Instead, the leaked code appears to point toward systems where:</p><ul><li>one layer plans,</li><li>another investigates,</li><li>another implements,</li><li>another verifies,</li><li>and the top-level interface orchestrates all of it.</li></ul><p>That is much closer to how teams work than how chatbots work.</p><p>And it solves one of the deepest problems in AI-assisted coding: a single agent is often too optimistic about its own output. A system with specialized roles can be slower, but more robust.</p><p>This is not just product polish. It is a move toward organizational structure inside the agent itself.</p><h3>The weirdest feature might also be the smartest: Buddy</h3><p>One of the more surprising references in the leaked material is “Buddy,” a Tamagotchi-style companion layer attached to the coding experience.</p><p>At first glance, this sounds trivial. A terminal pet. Personality. Stats. A novelty feature.</p><p>But it may be one of the most strategically intelligent things in the entire leak.</p><p>Because product stickiness is not created by utility alone. It is created by ritual, attachment, identity, and delight.</p><p>If developers are going to spend hours every day inside an AI coding environment, then the interface will not just compete on output quality. It will compete on feel.</p><p>A persistent companion system, however playful, does something important. It makes the tool feel alive. It makes the environment feel inhabited. It turns repeated usage into relationship, not just workflow.</p><p>That may sound silly. But that is how software becomes habit-forming.</p><p>Buddy may never become the main reason people use Claude Code. But if it exists, it reveals something important: Anthropic may be thinking not just about how Claude Code performs, but about how it lives with the user over time.</p><p>That is a very different product philosophy from “AI as utility.”</p><h3>“Undercover mode” is where the leak becomes socially important</h3><p>The most uncomfortable part of the leak is the reporting around a feature described as “undercover mode.”</p><p>If the public summaries of that code are accurate, the system appears to include logic or prompts aimed at avoiding explicit signals that AI was involved in certain public-facing contributions.</p><p>There are legitimate reasons a company might want controls like that.</p><p>A company may not want:</p><ul><li>internal model names leaking into public repositories,</li><li>proprietary workflows exposed in commit history,</li><li>internal system details surfacing accidentally,</li><li>or misleading metadata attached to external work.</li></ul><p>That is the strongest charitable interpretation.</p><p>But even with that framing, this part of the leak matters because it raises a larger question the industry has not answered well yet: what should transparency look like when AI systems participate directly in software production?</p><p>If an AI can:</p><ul><li>generate code,</li><li>write commit messages,</li><li>contribute to workflows,</li><li>and minimize visible signs of its involvement,</li></ul><p>then authorship becomes harder to reason about.</p><p>Not technically.<br>Socially.</p><p>Who wrote the code?<br>Who made the decision?<br>Who reviewed it?<br>Who is accountable when it fails?</p><p>AI-assisted development is already normal. That is not the controversial part anymore.</p><p>The controversy is invisibility.</p><p>And if frontier labs are actively building systems that can operate more quietly inside human workflows, the industry will need much clearer norms around provenance, disclosure, and responsibility.</p><p>This leak did not create that conversation.<br>But it may force it forward.</p><h3>The bigger story</h3><p>It is easy to read this leak as a security story.</p><p>Anthropic shipped a source map. People found code. The internet did what the internet does.</p><p>That is true, but it is also the least interesting possible reading.</p><p>The more important story is that the leaked code appears to show a frontier AI lab building toward a world where coding tools are no longer just assistants.</p><p>They are becoming systems that:</p><ul><li>monitor,</li><li>remember,</li><li>plan,</li><li>coordinate,</li><li>and increasingly act.</li></ul><p>That changes the nature of software development.</p><p>The long-term advantage will not come only from being a better prompter. It will come from building better environments for these systems to operate inside.</p><p>Teams with:</p><ul><li>cleaner project context,</li><li>clearer architectural notes,</li><li>better repo hygiene,</li><li>stronger review loops,</li><li>and more durable decision records</li></ul><p>will get far more leverage from agentic tools than teams that do not.</p><p>Not because they are better at AI.<br>Because they are better at collaboration under new conditions.</p><h3>Final thought</h3><p>Most people looked at the Claude Code leak and saw a mistake.</p><p>The more useful takeaway is the direction it appears to reveal.</p><p>If these leaked systems reflect Anthropic’s real development direction, then AI coding is moving away from reactive, session-bound assistance and toward something more persistent, proactive, and autonomous.</p><p>That is the real story.</p><p>And once you see that clearly, the question changes.</p><p>It is no longer:<br>“How do I use AI better?”</p><p>It becomes:<br>“How do I build in a world where AI is already part of the system?”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4397cb61aa03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Review Analytics MCP Server with TypeScript, Rules, LLMs, and Vector Search]]></title>
            <link>https://pub.towardsai.net/build-a-review-analytics-mcp-server-with-typescript-rules-llms-and-vector-search-15a6297e5f2a?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/15a6297e5f2a</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Thu, 12 Mar 2026 13:22:51 GMT</pubDate>
            <atom:updated>2026-03-18T04:58:14.310Z</atom:updated>
            <content:encoded><![CDATA[<h4>A production-grade AI pipeline that turns messy app reviews into structured product intelligence using rules, LLM routing, and vector search.</h4><h3>Introduction</h3><p>App reviews are one of the richest sources of product feedback, but they are also one of the hardest to operationalize. A few thousand reviews can contain urgent bugs, payment failures, broken login flows, feature requests, and noise all mixed together.</p><p>In this tutorial, we’ll build the kind of system that turns that raw review stream into structured product intelligence.</p><p>The system described here is implemented in the open-source project <a href="https://github.com/abhishekdubey331/ReviewRadar"><strong>ReviewRadar</strong></a>, a TypeScript MCP server for analyzing app reviews.</p><p>By the end, you’ll understand how to build a system that can:</p><ul><li>Import reviews from CSV, JSON, or app-store scraping</li><li>Redact sensitive data before any model call</li><li>Classify reviews into issue types, feature areas, severity, and sentiment</li><li>Route only uncertain or high-risk reviews to an LLM</li><li>Store reviews in a vector index for semantic search</li><li>Generate PM-ready outputs like top issues, spikes, and weekly reports</li><li>Expose the whole system as MCP tools for Cursor, Claude Desktop, or any MCP client</li></ul><h4>GitHub<strong> Repository</strong></h4><blockquote>The complete implementation for this tutorial is available in the open-source repository below.<br><a href="https://github.com/abhishekdubey331/ReviewRadar"><strong>https://github.com/abhishekdubey331/ReviewRadar</strong></a></blockquote><p>You can run the MCP server locally, import reviews, and experiment with the analytics tools described in this article.</p><h3>Final Result</h3><p>The finished system is an <strong>MCP server</strong> that sits behind an IDE agent and exposes tools such as:</p><ul><li>reviews_import</li><li>reviews_analyze</li><li>reviews_search</li><li>reviews_top_issues</li><li>reviews_weekly_report</li></ul><p>Instead of manually reading reviews, a PM can simply ask:</p><blockquote><em>What are the biggest customer pain points this week?</em></blockquote><p>And the server can return ranked issue clusters, severity breakdowns, spikes, and supporting review evidence.</p><p><strong>Quick Demo</strong></p><p>Below is an example of the ReviewRadar MCP server analyzing reviews and surfacing top issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hswLvbL5d4nZBUUGECfSYw.gif" /><figcaption>Demo: ReviewRadar MCP tools analyzing app reviews and surfacing top issues</figcaption></figure><h3>Architecture</h3><p>The core pipeline looks like this:</p><blockquote>This pipeline transforms raw review text into structured signals that product and engineering teams can analyze.</blockquote><p>Here’s how the components fit together:</p><p><strong>Ingestion layer</strong><br>Loads and normalizes reviews from files or scraped datasets.</p><p><strong>Privacy layer</strong><br>Redacts PII locally before any model interaction.</p><p><strong>Classification engine</strong><br>Runs deterministic rules first, then selectively calls the LLM.</p><p><strong>Vector store</strong><br>Indexes reviews for semantic search.</p><p><strong>Analytics layer</strong><br>Computes top issues, trends, segment breakdowns, and reports.</p><p><strong>MCP layer</strong><br>Exposes everything as callable tools over stdio.</p><p>That separation is the main reason the project works well: <strong>every layer has a focused responsibility.</strong></p><h3>Step 1: Define the Taxonomy and Contracts</h3><p>Before building the pipeline, define what the system should produce.</p><p>ReviewRadar starts with Zod enums and schemas.</p><pre>export const IssueTypeEnum = z.enum([<br>  &quot;Bug&quot;,<br>  &quot;Performance&quot;,<br>  &quot;UX&quot;,<br>  &quot;Feature Request&quot;,<br>  &quot;Account/Auth&quot;,<br>  &quot;Payments/Transactions&quot;,<br>  &quot;Billing/Pricing&quot;,<br>  &quot;Trust/Fraud&quot;,<br>  &quot;Support/Service&quot;,<br>  &quot;Cancellation/Retention&quot;,<br>  &quot;Data/Sync&quot;,<br>  &quot;Safety Concern&quot;,<br>  &quot;Praise&quot;,<br>  &quot;Spam / Bot / Irrelevant&quot;<br>]);<br><br>export const FeatureAreaEnum = z.enum([<br>  &quot;Crash Detection&quot;,<br>  &quot;Driving Reports&quot;,<br>  &quot;Family Location&quot;,<br>  &quot;SOS&quot;,<br>  &quot;Card Controls&quot;,<br>  &quot;Allowance/Chores&quot;,<br>  &quot;Savings/Investing&quot;,<br>  &quot;Bank Linking&quot;,<br>  &quot;Notifications&quot;,<br>  &quot;Onboarding&quot;,<br>  &quot;Login/OTP&quot;,<br>  &quot;Other&quot;,<br>  &quot;Unknown&quot;<br>]);<br>export const SeverityEnum = z.enum([&quot;P0&quot;, &quot;P1&quot;, &quot;P2&quot;, &quot;FYI&quot;]);</pre><p>This step matters because it:</p><ul><li>Defines the issue taxonomy once</li><li>Makes validation explicit</li><li>Aligns rules, prompts, analytics, and outputs</li><li>Prevents the LLM from inventing categories</li></ul><p>If you skip this step, the system becomes inconsistent very quickly.</p><h3>Step 2: Import and Normalize Reviews</h3><p>Next, we convert raw reviews into a clean internal format.</p><p>The ingestion layer normalizes reviews from CSV, JSON, or scraped app-store datasets into a single internal schema.</p><p>Example ingestion logic:</p><pre>for (const raw of rawReviews) {<br>  const normalized = normalizeReview(raw);<br><br>  const parsed = ReviewInputSchema.safeParse(normalized);<br>  if (!parsed.success) continue;<br><br>  const review = parsed.data;<br><br>  if (!reviewsMap.has(review.review_id)) {<br>    reviewsMap.set(review.review_id, review);<br>  }<br>}</pre><p>This step ensures:</p><ul><li>Inconsistent fields are normalized</li><li>Rows are validated with Zod</li><li>Malformed rows are dropped</li><li>Duplicate reviews are removed</li></ul><h3>Step 3: Add a Privacy Layer Before Any LLM Call</h3><p>Before sending data to any model, ReviewRadar redacts sensitive information locally.</p><pre>export function redactPII(content: string): string {<br>  const emailRegex = /[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/gi;<br>  const phoneRegex = /(?:\+?\d{1,3}[ \-.]?)?\(?\d{3}\)?[ \-.]?\d{3}[ \-.]?\d{4}/g;<br>  const coordRegex = /[-+]?\d{1,2}\.?\d*,\s*[-+]?\d{1,3}\.?\d*/g;<br><br>  return content<br>    .replace(emailRegex, &quot;[REDACTED]&quot;)<br>    .replace(phoneRegex, &quot;[REDACTED]&quot;)<br>    .replace(coordRegex, &quot;[REDACTED]&quot;);<br>}</pre><p>This ensures:</p><ul><li>Emails, phone numbers, and coordinates are scrubbed locally</li><li>Privacy is enforced automatically</li><li>LLM calls never accidentally leak PII</li></ul><h3>Step 4: Build the Hybrid Classification Engine</h3><p>The classification engine first runs deterministic rules.</p><p>Example spam filter:</p><pre>if (alphaCount &lt; 10) {<br>  return {<br>    issue_type: &quot;Spam / Bot / Irrelevant&quot;,<br>    feature_area: &quot;Other&quot;,<br>    severity: &quot;FYI&quot;,<br>    sentiment: &quot;Neutral&quot;,<br>    confidence_score: 1.0,<br>    classification_source: &quot;rule_engine&quot;,<br>    is_spam: true<br>  };<br>}</pre><p>Then the system decides whether the review should be escalated to an LLM.</p><pre>export function isLlmRequired(result: RuleResult): boolean {<br>  if (result.confidence_score &lt; 0.60) return true;<br>  if (result.feature_area === &quot;Unknown&quot;) return true;<br>  if (result.severity === &quot;P0&quot; || result.severity === &quot;P1&quot;) return true;<br>  return false;<br>}</pre><p>Hybrid classification flow:</p><pre>const redacted = redactPII(review.content);<br>const rulesRes = evaluateRules(redacted, review.score);<br><br>if (!isLlmRequired(rulesRes)) {<br>  return rulesRes;<br>}<br>const prompt = &quot;Classify this app review into the existing product taxonomy...&quot;;<br>const llmResp = await llmClient.processPrompt(prompt);</pre><p>Benefits of this design:</p><ul><li>Rules handle the majority of reviews</li><li>Only ambiguous or critical cases use the LLM</li><li>Costs stay low and results stay explainable</li></ul><h3>Step 5: Add Reliability and Batch Processing</h3><p>Once LLMs enter the pipeline, reliability becomes critical.</p><p>ReviewRadar adds:</p><ul><li>Concurrency limits</li><li>Retry logic</li><li>Circuit breakers</li><li>Batch metrics</li><li>Rule-engine fallback</li></ul><p>Example circuit breaker:</p><pre>if (this.state.consecutiveFailures &gt;= 10) {<br>  this.isTripped = true;<br>  throw new CircuitBreakerError();<br>}</pre><p>Batch processing example:</p><pre>const settledResults = await Promise.allSettled(<br>  rawInputReviews.map((review) =&gt; {<br>    const cachedTask = analysisCache.getOrCreate(<br>      review,<br>      () =&gt; processingLimit(() =&gt; processSingleReview(...))<br>    );<br>    return cachedTask.promise;<br>  })<br>);</pre><p>This ensures:</p><ul><li>Model calls stay within limits</li><li>Failures don’t crash the system</li><li>Duplicate reviews reuse cached results</li></ul><h3>Step 6: Add Vector Search</h3><p>Once reviews are classified, we can enable semantic search.</p><p>Embeddings example:</p><pre>const response = await openai.embeddings.create({<br>  model: &quot;text-embedding-3-large&quot;,<br>  input,<br>  dimensions: 1536<br>});</pre><p>Search combines:</p><ul><li><strong>Semantic vector similarity</strong></li><li><strong>Lexical keyword matching</strong></li></ul><pre>const semanticResults = buildSemanticSearchRecords(...);<br>const lexicalResults = buildLexicalSearchRecords(...);<br>return mergeSearchRecords(semanticResults, lexicalResults);</pre><p>Hybrid retrieval works especially well for review data, where exact phrases (“OTP not received”) matter just as much as semantic similarity.</p><h3>Step 7: Generate Analytics and MCP Tools</h3><p>Once reviews are structured, analytics becomes straightforward.</p><p>Example aggregation:</p><pre>const key = `${issueType}::${featureArea}`;<br>row.review_count += 1;<br>row.severity_breakdown[sev] += 1;</pre><p>Tools exposed via MCP:</p><ul><li>reviews_import</li><li>reviews_analyze</li><li>reviews_search</li><li>reviews_top_issues</li><li>reviews_weekly_report</li></ul><p>Server tool registration:</p><pre>server.setRequestHandler(CallToolRequestSchema, async (request) =&gt; {<br>  return dispatchToolCall(<br>    request.params.name,<br>    request.params.arguments,<br>    runtimeDeps<br>  );<br>});</pre><p>This transforms the system into <strong>reusable infrastructure</strong> rather than a single script.</p><h3>Key Design Decisions</h3><p>Several architectural choices make this system strong:</p><p><strong>Rules before LLM</strong><br>Cheaper, faster, and easier to debug.</p><p><strong>PII redaction in the pipeline</strong><br>Privacy is enforced by default.</p><p><strong>Hybrid search</strong><br>Semantic + lexical retrieval improves results.</p><p><strong>Structured analytics after classification</strong><br>Reporting becomes deterministic and reliable.</p><p><strong>MCP tool boundary</strong><br>Makes the system easily usable by IDE agents.</p><h3>Common Pitfalls</h3><p>If you build a similar system, avoid these mistakes:</p><ul><li>Sending every review to the LLM</li><li>Skipping a taxonomy definition</li><li>Treating privacy as an application-layer concern</li><li>Building reports directly from raw text</li><li>Ignoring degraded-mode behavior when models fail</li></ul><h3>Conclusion</h3><p>ReviewRadar shows how to build a practical AI backend without overusing AI.</p><p>A practical build order looks like this:</p><ol><li>Define taxonomy and response contracts</li><li>Ingest and normalize reviews</li><li>Redact PII</li><li>Build deterministic rules</li><li>Route uncertain reviews to the LLM</li><li>Add reliability controls</li><li>Index reviews for semantic search</li><li>Compute analytics on structured outputs</li><li>Expose capabilities as MCP tools</li></ol><p>The real power of this system is not one clever prompt.</p><p>It comes from combining <strong>schemas, rules, selective model usage, search, and analytics into a clean pipeline.</strong></p><h3>Further Improvements</h3><p>Future enhancements could include:</p><ul><li>Release-aware regression detection by app version</li><li>Incremental indexing instead of batch imports</li><li>Automatic summary extraction</li><li>Multiple embedding providers</li><li>A dashboard UI on top of the MCP server</li><li>Historical trend tracking for month-over-month analysis</li></ul><p>If you build something similar, remember the core principle:</p><blockquote>Use the LLM as a <strong>high-value component inside a well-structured system — not as the system itself.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15a6297e5f2a" width="1" height="1" alt=""><hr><p><a href="https://pub.towardsai.net/build-a-review-analytics-mcp-server-with-typescript-rules-llms-and-vector-search-15a6297e5f2a">Build a Review Analytics MCP Server with TypeScript, Rules, LLMs, and Vector Search</a> was originally published in <a href="https://pub.towardsai.net/">Towards AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seamless Real-Time Location Tracking with gRPC, Kotlin & Jetpack Compose]]></title>
            <link>https://proandroiddev.com/building-a-real-time-location-streaming-service-with-grpc-and-kotlin-a-better-alternative-to-62563f518cc8?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/62563f518cc8</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[grpc]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Sun, 08 Sep 2024 12:27:54 GMT</pubDate>
            <atom:updated>2024-09-29T03:34:38.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ATSWpVEeqinWVkY-8hh_JA.jpeg" /><figcaption><a href="https://unsplash.com/photos/a-google-maps-pin-sitting-on-top-of-a-piece-of-paper-gecohhknetQ">Pic</a> By: <a href="https://unsplash.com/@anandhu_chndrn">Anandhu Chandran</a></figcaption></figure><h3><strong>Introduction</strong></h3><p>In modern mobile applications, real-time location tracking is critical for many services like ride-hailing, delivery apps, or fitness trackers. Traditionally, developers relied on <strong>location polling</strong>, but it comes with several drawbacks such as <strong>high battery consumption</strong> and <strong>inconsistent location accuracy</strong>.</p><p>In this article, we’ll explore building a real-time location streaming service using <strong>gRPC</strong>, <strong>Kotlin</strong>, and <strong>Jetpack Compose</strong> — an efficient alternative to traditional location polling. The core highlight is leveraging <strong>Kotlin Flows</strong> to handle continuous updates as the backend emits location data in real-time. This approach ensures lower battery consumption, better accuracy, and a more responsive UI built with <strong>Jetpack Compose</strong>. With <strong>gRPC</strong> streams and Kotlin Flows working together, we will achieve efficient, seamless location tracking in our Android app.</p><h3><strong>Traditional Approaches: The Pitfalls of Location Polling</strong></h3><p>Before we dive into the more modern approach, let’s briefly discuss why location polling has been the go-to method for many developers and what its limitations are.</p><p><strong>Location Polling</strong> involves periodically requesting a user’s location at fixed intervals. However, this approach has inherent problems:</p><ol><li><strong>Battery Drain</strong>: Frequent GPS polling consumes significant power.</li><li><strong>Latency Issues</strong>: Polling misses out on precise movements occurring between intervals.</li><li><strong>Increased Network Load</strong>: Constant requests result in higher bandwidth usage, increasing the load on the server.</li></ol><p>Here’s a typical example of how location polling works in code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mqFdvLulBwl7BsfN484htA.png" /></figure><h3><strong>Enter gRPC: Real-Time Location Streaming</strong></h3><p>gRPC is a modern RPC (Remote Procedure Call) framework that supports streaming data, both client-to-server and server-to-client. gRPC’s ability to stream offers a clear advantage in mobile applications where <strong>efficiency and precision</strong> are essential. Using <strong>gRPC</strong> with Kotlin for location updates offers several advantages:</p><ul><li><strong>Efficient Streaming:</strong> Instead of polling, you get continuous, real-time updates.</li><li><strong>Reduced Latency:</strong> As soon as the location changes, the client is notified.</li><li><strong>Lower Battery Consumption:</strong> By avoiding frequent network requests, gRPC reduces the battery drain.</li></ul><p>In the following sections, I’ll guide you through how to implement a <strong>gRPC-based location streaming service</strong>.</p><h3><strong>Step 1: Define the Protocol (Protobuf)</strong></h3><p>We will use Protocol Buffers (protobuf) to define our service and messages for location updates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q4W68wPNpvpEc3rZ49xRiw.png" /></figure><h3><strong>Step 2: Implementing the gRPC Server</strong></h3><p>The <strong>server</strong> will simulate real-time location updates for a predefined path using Kotlin and the <strong>Flow API</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtv8QUxDneR_0J-L6GJ7ag.png" /></figure><p>The server continuously streams location updates by emitting them in regular intervals.</p><h3><strong>Step 3: Running the Server</strong></h3><p>You can run the server directly by executing the main method in the LastKnownLocationServer.kt. The server will start on port <strong>9000</strong> by default and begin streaming location data to clients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWkyNRhba6wGeWzcSWocOw.png" /></figure><p>Once you run this, the server will simulate a 10km trip by sending location data to the client in real time.</p><h3><strong>Step 4: Implementing the Client</strong></h3><p>In the client implementation, we follow <strong>Clean Architecture</strong> principles by separating the data access logic (repository) from the business logic (use case). This approach ensures the code is more modular, testable, and maintainable.</p><ol><li><strong>LocationRepository.kt</strong></li></ol><p>The LocationRepository handles the interaction with the gRPC service and streams location updates to the application. It communicates with the gRPC server and processes the location data emitted by the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxjF8pgV9u2aey133-gZRQ.png" /></figure><p><strong>Explanation</strong>:</p><ul><li>The repository class interacts with the gRPC LocationService.kt.</li><li>The streamLocationUpdates method uses Kotlin&#39;s Flow to continuously receive location updates from the server.</li><li>Each update is processed and converted into a standard Android Location object.</li></ul><p><strong>2. FetchLocationUpdatesUseCase .kt</strong></p><p>The use case handles the logic for streaming location updates. It requests location updates for a specific user and provides the data to be used by the UI (or other parts of the app).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRMqSAthHhxKMm1taOzQPQ.png" /></figure><ul><li><strong>Explanation</strong>:</li><li>The FetchLocationUpdatesUseCase is implemented as a function interface, making it easy to invoke directly.</li><li>The use case calls the repository to fetch location updates.</li><li>The invoke method accepts a userId as a parameter and streams the corresponding location data.</li></ul><p>3. <strong>ViewModel Implementation</strong></p><p>Finally, the MapScreenViewModel consumes the FetchLocationUpdatesUseCase and provides the location data to the UI in a clean and structured way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67HqFXHZu_Ca7AJ34FxmVg.png" /></figure><p><strong>Explanation</strong>:</p><ul><li>The MapScreenViewModel.kt leverages the use case to stream location updates and manages the UI state using a StateFlow.</li><li>It listens for location updates and updates the map view when new data arrives.</li></ul><h3><strong>Step 5: Displaying Location on the Map</strong></h3><p>Once the location updates are received, we use Jetpack Compose to display the car’s location on Google Maps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*850BbcKO6CatTQTC39CpxA.png" /></figure><p>Check out the <strong>real-time demo</strong> in the repositories below:</p><ol><li><a href="https://github.com/abhishekdubey331/StreamLocationService-gRPC">Server Repository</a></li><li><a href="https://github.com/abhishekdubey331/StreamLocations-gRPC">Client Repository</a></li></ol><p><strong>Finally The Demo 🚀</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*2GHNLDCI84CUajw_JGkmdQ.gif" /></figure><h3>Conclusion</h3><p>In this article, we compared the traditional polling method with a more modern approach: real-time location streaming using gRPC. We explored how gRPC helps you to overcome the limitations of polling, offering real-time location updates while being more efficient in terms of battery consumption and network usage.</p><p>By utilizing Kotlin, Jetpack Compose, and gRPC in your Android apps, you can deliver real-time features with ease while ensuring better performance.</p><p>Connect with me on LinkedIn to discuss this topic further and explore more of my work: <a href="https://www.linkedin.com/in/abhishekdubey331">linkedin.com/abhishekdubey331</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62563f518cc8" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/building-a-real-time-location-streaming-service-with-grpc-and-kotlin-a-better-alternative-to-62563f518cc8">Seamless Real-Time Location Tracking with gRPC, Kotlin &amp; Jetpack Compose</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boost Developer Efficiency: Automate Android Login Workflows with ADB and Python]]></title>
            <link>https://proandroiddev.com/effortless-account-switching-automate-your-android-app-login-flow-with-python-and-adb-8a5aea83924d?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a5aea83924d</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[automation-tools]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Thu, 15 Aug 2024 13:52:08 GMT</pubDate>
            <atom:updated>2024-08-27T15:24:46.007Z</atom:updated>
            <content:encoded><![CDATA[<p>In this guide, we’ll walk through the steps to automate the login flow of a mobile application, addressing the common pain points of repetitive and time-consuming manual logins. By automating this process, developers and quality engineers can switch accounts quickly and efficiently, significantly reducing the time spent on testing and debugging across multiple accounts. This approach not only streamlines the workflow but also minimizes the potential for human error during manual logins, leading to a more productive and error-free development process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQ8JyiNWoVZ6Ve2p2NVUcA.jpeg" /><figcaption>Self created on Bing Co Pilot Designer</figcaption></figure><p>The first step in this automation journey is identifying the exact positions of the UI elements we need to interact with, such as the username and password fields. Knowing these positions allows us to simulate touch inputs programmatically, paving the way for a fully automated login experience.</p><h3>1. Getting the Bounds for Edit Text Elements</h3><p>To automate login, we need the exact positions of the input fields (Edit Text) for the username and password.</p><h4>Enabling Pointer Location</h4><ol><li><strong>Enable Developer Options</strong>: On your Android device, go to Settings &gt; About phone and tap Build number multiple times until developer mode is enabled.</li><li><strong>Enable Pointer Location</strong>: Go to Settings &gt; System &gt; Developer options and turn on Pointer location.</li></ol><p>With Pointer Location enabled, you can see the exact coordinates on your screen on the top you have to note the values of X and Y which will help us to create our <strong>adb</strong> command to help us login.</p><h4>Finding UI Element Coordinates</h4><ul><li><strong>Open the Login Screen</strong>: Navigate to the login screen with the username and password fields.</li><li><strong>Note Coordinates</strong>: Record the coordinates for the username field, password field, and login button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*SOxorvvRnxMT7AI6JZr2jg.gif" /></figure><h3>2. Creating ADB Commands for Login</h3><p>Using the coordinates from the previous step, we can create ADB commands to automate the login process.</p><h4>Example ADB Commands</h4><p>Assume you have the following details for your app:</p><ul><li><strong>Username Field Coordinates</strong>: username_field_x_coord and username_field_y_coord</li><li><strong>Password Field Coordinates</strong>: password_field_x_coord and password_field_y_coord</li><li><strong>Login Button Coordinates</strong>: login_btn_x_coord and login_btn_y_coord</li><li><strong>Verification Code/OTP</strong>: Input after login (if applicable)</li></ul><p>The ADB command to automate the login process might look like this:</p><h4>Sample command with placeholder</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s31St31uN9Fgq6U7xP7yGQ.png" /><figcaption><a href="https://www.ray.so/">Sample command-Ray.so</a></figcaption></figure><h4>Breakdown of Commands</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oezEK2ogXSJ8YizJr3lWaQ.png" /><figcaption><a href="https://www.ray.so/">Commands Breakdown-Ray.so</a></figcaption></figure><h3>3. Running ADB Command with termial 🎉</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*TZ62JsoySAU5e0SMDS6R4w.gif" /></figure><p>We’ve automated the login process using the command we constructed. Notice how the command efficiently taps the username and password fields, inputs the credentials, and logs in automatically. This approach not only saves time but also ensures accuracy during repetitive login tasks.</p><p>Whether you’re a <strong>developer or </strong>a <strong>QA engineer</strong>, this method can streamline your workflow, making it easier to test and switch between accounts while developing your app. Give it a try and experience the convenience for yourself!</p><h3>Now let’s have some automation and take the things to next level 🚀</h3><h3>4. Running ADB Commands with Python</h3><p>To automate the execution of these commands, we’ll use a Python script.</p><h4>Creating server.py</h4><p>First, ensure Python is installed. If not, download and install it from the official Python website.</p><p>Create a file named server.py with the following content:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45-uPlme5w4GXHRq03_duA.png" /><figcaption><a href="https://ray.so/">server.py Ray.so</a></figcaption></figure><p>This script sets up a Flask server that executes ADB commands based on POST requests. You can get the code for server.py <a href="https://gist.github.com/abhishekdubey331/deda8a9748174567f353c6a4c876710c">here</a>.</p><h3>5. Setting Up Flask</h3><h4>Installing Flask</h4><p>Install Flask using pip:</p><pre>pip install flask</pre><h4>Running the Server</h4><p>Start the server with:</p><pre>python server.py</pre><p>The server will run on <a href="http://localhost:5000.">http://localhost:5000</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VlcKCFPZ23uj9moO_joo_g.png" /></figure><h3>5. Creating the HTML Interface</h3><p>To interact with our Python server, we&#39;ll create a simple HTML page that allows users to input their credentials and trigger the login process. Additionally, we&#39;ll cache these test credentials in cookies for easy reuse.</p><h4>Step 1: Create the static Folder</h4><p>First, create a folder named static in the same directory where you&#39;ve created your server.py file. This static folder will hold our HTML and CSS files.</p><p><strong>Link</strong> — <a href="https://gist.github.com/abhishekdubey331/deda8a9748174567f353c6a4c876710c"><strong>server.py</strong></a></p><h4>Step 2: Create the index.html File</h4><p>Inside the static folder, create a file named index.html. This file will serve as the front-end interface for our application, which will be opened when we access the &quot;/&quot; route.</p><p><strong>Link</strong> — <a href="https://gist.github.com/abhishekdubey331/d4be66f83ad907b9bfb2991e58b1127c"><strong>index.html</strong></a></p><h4>Step 3: Create the styles.css File</h4><p>In the same static folder, create a styles.css file to add some basic styling to our HTML page.</p><p><strong>Link</strong> — <a href="https://gist.github.com/abhishekdubey331/7a2aa78c4d6519914329c1fe76911b64"><strong>styles.css</strong></a></p><h3>6. Putting Everything into Action</h3><p>Now when we run the command python server.py and open <a href="http://localhost:5000.">http://localhost:5000</a> we will see our web page with a text field to enter the credentials and when we press login we see the action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*9WFaQ4LmytAqvtZeYCAcXQ.gif" /></figure><h3>7. Conclusion</h3><p>By following these steps, you’ve created a system for automating the login flow of your mobile app. This setup simplifies the account switching process for developers and quality engineers, making testing and development more efficient. You can customize this setup to meet your specific needs and integrate it into your workflow.</p><p>Feel free to expand upon this guide as needed!</p><p>Connect with me on LinkedIn to discuss this topic further and explore more of my work: <a href="https://www.linkedin.com/in/abhishekdubey331">linkedin.com/abhishekdubey331</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a5aea83924d" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/effortless-account-switching-automate-your-android-app-login-flow-with-python-and-adb-8a5aea83924d">Boost Developer Efficiency: Automate Android Login Workflows with ADB and Python</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Event-Driven Solution in Android Without BroadcastReceiver]]></title>
            <link>https://medium.com/@abhishekdubey331/building-an-event-driven-solution-in-android-without-broadcastreceiver-9ca59c4a0dbf?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ca59c4a0dbf</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Sun, 28 May 2023 13:09:24 GMT</pubDate>
            <atom:updated>2023-05-28T14:38:01.637Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-hqMeYHw28nRcQCcq2oaQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@scottsweb"><strong>Scott Evans</strong></a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p><strong>Introduction:</strong> In Android development, the BroadcastReceiver class has long been a popular choice for receiving and handling system-wide broadcasts. However, in certain cases, you may prefer a more flexible and decoupled approach. In this article, we&#39;ll explore an alternative solution to BroadcastReceiver by designing our own event-driven system using a custom event broadcaster. By leveraging this architecture, you can achieve similar functionality while maintaining greater control over event handling and minimizing dependencies. Let&#39;s dive in!</p><h3>Setting Up the EventBroadcaster Class</h3><p>To begin, we’ll create a custom class called EventBroadcaster, which will act as our event broadcaster. This class will manage a list of listeners and provide methods to register, unregister, and notify those listeners when events occur. Here&#39;s an example implementation:</p><pre>package com.custom.broadcast.receiver.broadcastreceiver<br><br>class EventBroadcaster {<br>  <br>    private val listOfListeners: MutableSet&lt;EventListener&gt; = HashSet()<br><br>    fun registerListener(eventListener: EventListener) {<br>        listOfListeners.add(eventListener)<br>    }<br><br>    fun unregisterListener(eventListener: EventListener) {<br>        listOfListeners.remove(eventListener)<br>    }<br><br>    fun notifyEvent(event: Event) {<br>        listOfListeners.forEach {<br>            it.onEventReceived(event);<br>        }<br>    }<br>}</pre><h3>Defining the Event Class</h3><p>Next, we need to define our custom Event class. This class will encapsulate the data associated with a specific event. Depending on your use case, you can add properties, methods, and constructors to suit your needs. Here&#39;s a basic example:</p><pre>package com.custom.broadcast.receiver.broadcastreceiver<br><br>data class Event(val eventName: String)</pre><h3>Implementing the EventListener Interface</h3><p>We’ll create an EventListener interface that defines the callback method for receiving events. Any class that wishes to receive events must implement this interface and provide its own implementation of the onEventReceived() method. Here&#39;s an example:</p><pre>package com.custom.broadcast.receiver.broadcastreceiver<br><br>interface EventListener {<br>    fun onEventReceived(event: Event)<br>}</pre><h3>Registering and Handling Events in Activities or Fragments</h3><p>In your activity or fragment where you want to receive events, create an instance of EventBroadcaster and register an event listener. Here&#39;s an example implementation within an activity:</p><pre>package com.custom.broadcast.receiver.ui<br><br>import android.os.Bundle<br>import android.widget.Toast<br>import androidx.activity.ComponentActivity<br>import com.custom.broadcast.receiver.broadcastreceiver.Event<br>import com.custom.broadcast.receiver.broadcastreceiver.EventBroadcaster<br>import com.custom.broadcast.receiver.broadcastreceiver.EventListener<br>import com.custom.broadcast.receiver.databinding.ActivityMainBinding<br><br>class MainActivity : ComponentActivity(), EventListener {<br><br>    private lateinit var eventBroadcaster: EventBroadcaster<br>    private lateinit var binding: ActivityMainBinding<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br>        eventBroadcaster = EventBroadcaster()<br>        binding = ActivityMainBinding.inflate(layoutInflater)<br>        val view = binding.root<br>        setContentView(view)<br>        binding.customBroadCastTv.setOnClickListener {<br>            val event = Event(&quot;ButtonClicked&quot;) // Sending the Event<br>            eventBroadcaster.notifyEvent(event)<br>        }<br>    }<br><br>    override fun onEventReceived(event: Event) {<br>        Toast.makeText(this, &quot;Event Received&quot;, Toast.LENGTH_SHORT).show()<br>    }<br><br>    override fun onStart() {<br>        super.onStart()<br>        eventBroadcaster.registerListener(this)<br>    }<br><br>    override fun onStop() {<br>        super.onStop()<br>        eventBroadcaster.unregisterListener(this)<br>    }<br>}</pre><p>Remember to unregister the listener in the onDestroy() method to avoid potential memory leaks.</p><h3>Sending Events</h3><p>To send an event, call the notifyEvent() method of your EventBroadcaster instance, passing in the event object. Here&#39;s an example:</p><pre>val event = Event(&quot;ButtonClicked&quot;)<br>eventBroadcaster.notifyEvent(event)</pre><h3>Conclusion</h3><p>By building our own event-driven solution without relying on BroadcastReceiver, we&#39;ve gained greater control and flexibility in handling events in Android applications. This approach allows for decoupled components, easier testing, and a more maintainable codebase. Whether you&#39;re working on a small project or a large-scale application, understanding and implementing an event-driven architecture can greatly enhance the modularity and extensibility of your code.</p><p>In this article, we covered the basic implementation of an event-driven system using a custom event broadcaster, defining event classes, implementing event listeners, and handling events. <br><strong>Happy coding! 🔖 Don’t forget to give it a clap 👏 if you find it helpful, and feel free to share it with your fellow developers!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ca59c4a0dbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin Local Functions: Enhance Maintainability and Encapsulation]]></title>
            <link>https://medium.com/@abhishekdubey331/understanding-local-functions-in-kotlin-powerful-and-flexible-dd71b25dc30a?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd71b25dc30a</guid>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Sat, 27 May 2023 14:06:02 GMT</pubDate>
            <atom:updated>2023-05-27T14:09:39.112Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LY67KNHm1F82lreqgae50A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@mreichelt">Marc Reichelt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Introduction: Kotlin is a versatile programming language known for its conciseness and expressiveness. One of its standout features is the ability to define functions within functions, known as local functions. In this article, we will explore the concept of local functions in Kotlin and understand how they can enhance code readability, reusability, and maintainability.</p><p>What are Local Functions? Local functions, as the name suggests, are functions defined within the scope of another function. Unlike regular functions, which are defined at the top level, local functions are encapsulated within their enclosing function and can only be accessed from within it. This feature allows developers to create small, specialized functions that are closely related to the task at hand, making the code more modular and easier to comprehend.</p><p>Benefits of Local Functions:</p><ol><li><strong>Improved Code Readability:</strong> By defining functions closer to their usage, local functions enhance code readability. They provide context and reduce the cognitive load on developers, making it easier to understand the purpose and behavior of a particular piece of code.</li><li><strong>Encapsulation and Information Hiding:</strong> Local functions are encapsulated within their parent function, preventing them from being accessed from outside. This encapsulation promotes information hiding and reduces the risk of unintended usage or modification, making the code more robust and reliable.</li><li><strong>Code Reusability:</strong> Local functions can be reused within the enclosing function, eliminating the need to duplicate code. This promotes the “Don’t Repeat Yourself” (DRY) principle, allowing developers to write concise and maintainable code.</li><li><strong>Access to Enclosing Function’s Variables:</strong> Local functions have access to variables in the enclosing function, including its parameters and local variables. This enables them to utilize and manipulate the state of the enclosing function, enhancing their flexibility and usefulness.</li></ol><p><strong>🔍 Example 1:</strong> Let’s consider a simple example to illustrate the usage of local functions. Suppose we have a function that calculates the factorial of a given number:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSWSM1LMiG9mP9NSVqU13Q.png" /></figure><p>In the above code snippet, the factorial function is a local function defined within calculateFactorial. It recursively calculates the factorial of a number. By using a local function, we encapsulate the factorial logic within the main function, keeping the code focused and self-contained.</p><p><strong>🔍 Example 2:</strong> Calculating Fibonacci Series<br>Consider a scenario where you need to calculate the Fibonacci series for a given number of terms. Let’s leverage local functions to achieve this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHG64D2RzPlKVQoG22gJfg.png" /></figure><p>In this code snippet, we define the fibonacci function as a local function within calculateFibonacci. It recursively calculates the Fibonacci series. By using a local function, we encapsulate the Fibonacci logic within the main function, resulting in cleaner and more focused code.</p><p><strong>Conclusion:</strong> Local functions are a powerful and flexible feature in Kotlin that allow developers to create modular, reusable, and maintainable code. By encapsulating functions within their parent functions, Kotlin promotes better code organization, readability, and information hiding. Leveraging local functions can significantly enhance your Kotlin projects, making them more efficient and easier to understand.</p><p>Incorporate local functions in your Kotlin code and experience the benefits they bring to your development workflow. Happy coding!<br>Hit clap if you like what you read. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*UcrcRXbJ0Oday4QyX9AzYQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd71b25dc30a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Power of Kotlin Destructuring: Simplify Your Code with Ease]]></title>
            <link>https://medium.com/@abhishekdubey331/unveiling-the-power-of-kotlin-destructuring-simplify-your-code-with-ease-b0c2c918d60b?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0c2c918d60b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <category><![CDATA[destructuring]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Tue, 23 May 2023 11:45:47 GMT</pubDate>
            <atom:updated>2023-05-26T18:30:01.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qnSJYqpgWWLHo_8RJcW_eg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@mreichelt">Marc Reichelt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction:</strong> The concept of destructuring was introduced in programming languages such as JavaScript and Python before Kotlin. Both JavaScript and Python have the ability to destructure objects and arrays, allowing you to extract individual elements or properties into separate variables in a convenient and concise manner. Kotlin, being a modern statically-typed programming language, also adopted this concept and added support for destructuring declarations, enabling developers to extract values from data structures like arrays and objects with ease.In this article, we will explore the concept of destructuring in Kotlin and see how it simplifies your code and enhances readability.</p><p><strong>Basic Destructuring: </strong>Destructuring enables you to extract multiple values from a single data structure, such as a data class, pair, or list. Let’s start with a simple example using a data class:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2actaVdZH9KxTKnlwvnmw.png" /></figure><p>In the above code, we define a data class Person with properties name and age. By using destructuring declaration (name, age) = person, we extract the values from the person object and assign them to variables name and age respectively. This concise syntax eliminates the need for manual property access.</p><p><strong>Destructuring Declarations with Pair:</strong> Destructuring can be especially handy when combined with functions that return a Pair object. <br>The code below demonstrates how destructuring declarations can be used to conveniently extract values from a Pair object and assign them to variables in a concise and readable way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNZum6WrRsGXCgW44Tx_3A.png" /></figure><p>By using destructuring declaration (minValue, maxValue) = findMinMax(numbers), we extract the minimum and maximum values returned by the function into separate variables. This approach enhances code readability and avoids the need for additional variable assignments.</p><p><strong>Destructuring Declarations with Maps:</strong> Destructuring is also applicable to maps, allowing you to extract key-value pairs effortlessly. Consider the following example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHjUqG-gsyN3ScwaENMg3w.png" /></figure><p>In the above case, The for loop iterates over each entry in the medals map using destructuring declarations. The map entry is deconstructed into two variables, position and medal.</p><p><strong>Underscore for Unused Values:</strong> In situations where you’re only interested in extracting some values and not all of them, you can use the underscore _ as a placeholder for the unused values. Consider the following example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7d7BC8sWs0XI6EGy6zHhw.png" /></figure><p>Here, we are only interested in the name and city properties of the person object, while ignoring the age property. Using _ as a placeholder helps us indicate that the value is not needed.</p><p><strong>Conclusion:</strong> Kotlin’s destructuring feature provides a clean and concise way to extract values from data structures. Whether you’re working with data classes, pairs, lists, or maps, destructuring declarations simplify your code and enhance readability by eliminating the need for manual property access. By embracing destructuring in your Kotlin code, you can unlock its power and make your code more expressive and efficient.</p><p><strong>So, why not leverage the benefits of Kotlin’s destructuring and streamline your code today? Embrace this powerful feature and enjoy writing cleaner and more readable code. Happy coding with Kotlin.</strong></p><p>Hit clap if you like what you read. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*UcrcRXbJ0Oday4QyX9AzYQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0c2c918d60b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Harnessing the Power of Kotlin Flow: Effortlessly Fetch User Location]]></title>
            <link>https://proandroiddev.com/fetching-user-location-using-kotlin-flow-6121557fc7b7?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/6121557fc7b7</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[kotlin-flow]]></category>
            <category><![CDATA[kotlin-coroutines]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 17:06:28 GMT</pubDate>
            <atom:updated>2024-09-15T17:51:03.121Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7GBv_waMqw17mDpqZ1CbAA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@aronvisuals">Aron Visuals</a> on <a href="https://unsplash.com/">Unsplash.com</a></figcaption></figure><p>During my recent exploration of Kotlin Flows, I stumbled upon a fascinating feature called Kotlin callbackFlow. In this article, we will delve into the concept of <a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/callback-flow.html"><strong>callbackFlow</strong></a> and explore its applications in Android, particularly in emitting flows from callback implementations. Today, our focus will be on utilizing callbackFlow to fetch the user’s location. But before we dive into that, let’s take a look at the traditional approach we usually employ to retrieve the user’s location.</p><blockquote><strong>TL;DR — You can find the whole implementation on </strong><a href="https://github.com/abhishekdubey331/CallbackFlow-Location"><strong>GitHub</strong></a><strong>.</strong></blockquote><p>We have our GeoLocationListener.kt which is an interface that will be used for providing the location to our FetchLocationActivity.kt.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16b38d08cb60c445b7dd8265e5a7df89/href">https://medium.com/media/16b38d08cb60c445b7dd8265e5a7df89/href</a></iframe><p>Next, we have the LocationProvider.kt which fetches the user location and provides it to our FetchLocationActivity.kt which implements the GeoLocationListener.kt interface.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7f95153567ff0cf2666b9b18a81bb9c8/href">https://medium.com/media/7f95153567ff0cf2666b9b18a81bb9c8/href</a></iframe><p>Now let’s see how we will use this LocationProvider.kt in our FetchLocationActivity.kt. In our activity, we can use the Location object received in onCurrentGeoLocationSuccess(location: Location) to extract latitude and longitude.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f9bd389ce7d16b3c22c5eaa57213b8c/href">https://medium.com/media/2f9bd389ce7d16b3c22c5eaa57213b8c/href</a></iframe><blockquote><strong>Implementing Location Fetching with callbackFlow</strong></blockquote><p>In this section, we will focus on the main topic of this article, which is utilizing callbackFlow to fetch the user’s location. To achieve this, we will follow the principles of Clean Architecture and employ the MVVM (Model-View-ViewModel) design pattern. Let’s start by creating a UseCase specifically for fetching the user’s location, which we will name FetchLocationUseCase.kt.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/260feb750c68e8bcf6a457193021e11d/href">https://medium.com/media/260feb750c68e8bcf6a457193021e11d/href</a></iframe><p>Now we will provide the implementation for our FetchLocationUseCase.kt as FetchLocationUseCaseImpl.kt. We will be using <strong>Hilt </strong>for dependency injection and will be injecting FetchLocationUseCase in our ViewModel. Below is the implementation for <strong>FetchLocationUseCase.kt</strong></p><blockquote><a href="https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/callback-flow.html"><strong>callbackFlow</strong></a><strong> </strong>is a flow builder that lets you convert callback-based APIs into flows. More information here <a href="https://developer.android.com/kotlin/flow#callback">Convert callback-based APIs to flows</a></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecf4b802eca7453f4745328470e05c05/href">https://medium.com/media/ecf4b802eca7453f4745328470e05c05/href</a></iframe><p>Now let’s see how our ViewModel will use <strong>FetchLocationUseCase.kt </strong>to receive fetched location and later it can use this latitude and longitude for further requirements.</p><blockquote>Do not worry if you see some extra things being done here I will share the GitHub repo for the sample project which contains all the code. Here I have used only some samples for giving a high-level idea about the implementations.</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73f0f3fcbc641ad67a1af1f6144abf85/href">https://medium.com/media/73f0f3fcbc641ad67a1af1f6144abf85/href</a></iframe><p>Now we have received our location in</p><pre>is ResultState.Success -&gt; { <br>    val latitude = result.data.latitude <br>    val longitude = result.data.longitude<br>    saveLatLongToSavedStateBundle(latitude, longitude)  <br>    fetchNearByVenues(latitude, longitude) <br>}</pre><p><strong>Great! If you have followed all along. The code for this sample project can be found here on </strong><a href="https://github.com/abhishekdubey331/CallbackFlow-Location"><strong>GitHub</strong></a><strong>. All suggestions for improvements are welcomed. Please star the repository if you found the code useful.</strong></p><p>Hit clap if you like what you read. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6121557fc7b7" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/fetching-user-location-using-kotlin-flow-6121557fc7b7">Harnessing the Power of Kotlin Flow: Effortlessly Fetch User Location</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Gradle to secure app keys in Android]]></title>
            <link>https://medium.com/@abhishekdubey331/using-gradle-to-secure-app-keys-in-android-9d2796ca4007?source=rss-d850eac64a37------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d2796ca4007</guid>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-apps]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Abhishek Dubey]]></dc:creator>
            <pubDate>Wed, 05 Feb 2020 17:43:25 GMT</pubDate>
            <atom:updated>2023-05-26T18:33:14.498Z</atom:updated>
            <content:encoded><![CDATA[<h3>Securing API Keys in Android with Gradle: Safeguarding Sensitive Information</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujPT0TYw45ZSTlUzJN2oIg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@franckinjapan">franckinjapan </a>on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Introduction:<br>When working on Android projects, there are often situations where we need to securely store API keys for third-party SDKs or other resource keys. In this article, we will explore a method to safely store API keys using the gradle.properties file in Android Studio. By leveraging this approach, we can keep sensitive information separate from our codebase and minimize the risk of exposing sensitive data.</p><p>Step 1: Adding gradle.properties to .gitignore 👥</p><p>To safeguard our API keys and prevent them from being exposed in version control, we need to add the gradle.properties file to the .gitignore configuration. This ensures that the sensitive information remains confidential and is not tracked by Git. Follow these steps to exclude the gradle.properties file from version control:</p><ol><li>In your Android Studio project, locate the .gitignore file. It is typically found in the root directory of your project.</li><li>Open the .gitignore file in a text editor or directly within Android Studio.</li><li>Append the following line to the file: gradle.properties</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ql3F_MN_WDDTtGUNsDfywg.png" /></figure><p>This line instructs Git to ignore the gradle.properties file when committing changes.</p><p>4. Save the .gitignore file.</p><p>By adding gradle.properties to the .gitignore file, we ensure that the file is not shared or visible in the version control system. This step helps maintain the confidentiality of our API keys and other sensitive data.</p><p>Step 2: Storing API Keys in gradle.properties 🔒</p><p>Now that we have taken the necessary precaution to prevent the gradle.properties file from being tracked by Git, we can proceed to store our API keys securely. The gradle.properties file allows us to define custom key-value pairs, making it an ideal place to store sensitive information. Follow these steps to store your API keys:</p><ol><li>Locate the gradle.properties file in your Android project. It is usually located in the root directory of the project.</li><li>Open the gradle.properties file in a text editor or directly within Android Studio.</li><li>Add a new line to the file using the following format: API_KEY=&quot;YOUR_API_KEY&quot;. Replace YOUR_API_KEY with your actual API key value. You can define multiple keys by adding additional lines in the same format.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Farlp1SRzLcpQ7q0-gVljQ.png" /></figure><p>Replace YOUR_API_KEY with your actual API key value. You can define multiple keys by adding additional lines in the same format.</p><p>4. Save the gradle.properties file.</p><p>By storing our API keys in the gradle.properties file, we separate them from our source code, reducing the risk of exposing sensitive information. This approach allows us to easily manage and update our keys without modifying the codebase.</p><p>Step 3: Accessing API Keys in the Code 📲</p><p>After securely storing our API keys, we need to access them in our code. Follow these steps to retrieve the API keys stored in the gradle.properties file:</p><ol><li>Open your app’s build.gradlefile (usually located in the app module).</li><li>Inside the android block, add the following code snippet:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N94H7HxNCZd0Wxhg0ct9Qg.png" /></figure><p>This code creates a build configuration field named API_KEY of type String and assigns the value stored in the gradle.properties file.</p><p>3. Save the build.gradlefile.</p><p>4. To access the API key in your code, use the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmvEp2Sxj0pPQo97n4LXaw.png" /></figure><p>The BuildConfig class is automatically generated by the Android build system, and it provides access to the build configuration fields defined in the build.gradle file.</p><p>By following these steps, we can securely store our API keys and access them in our Android code without exposing them directly. This helps protect our sensitive information and reduces the risk of unauthorized access or misuse.</p><p>Conclusion: Securing API keys and other sensitive information is crucial for Android developers. By leveraging the gradle.properties file and properly configuring our project, we can separate our API keys from the codebase and minimize the risk of exposing sensitive data. By following these best practices, we can ensure the security and integrity of our Android applications.</p><p>Hit clap if you like what you read. :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/0*5q5bsFBidobfN4R3.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d2796ca4007" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>