<?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 Niraj Prajapati on Medium]]></title>
        <description><![CDATA[Stories by Niraj Prajapati on Medium]]></description>
        <link>https://medium.com/@niraj_prajapati?source=rss-6134755863e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CwgEN8AupywoLKE9joKiFg.jpeg</url>
            <title>Stories by Niraj Prajapati on Medium</title>
            <link>https://medium.com/@niraj_prajapati?source=rss-6134755863e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:21:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@niraj_prajapati/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[Build a Custom Crash UI for Android: Say Goodbye to Default]]></title>
            <link>https://medium.com/@niraj_prajapati/build-a-custom-crash-ui-for-android-say-goodbye-to-default-f885489da2ce?source=rss-6134755863e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/f885489da2ce</guid>
            <category><![CDATA[android-libraries]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[app-crash]]></category>
            <category><![CDATA[android-ui]]></category>
            <dc:creator><![CDATA[Niraj Prajapati]]></dc:creator>
            <pubDate>Fri, 23 Dec 2022 07:24:53 GMT</pubDate>
            <atom:updated>2025-01-26T14:06:40.826Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G_pXGVmwRBOTjuQ5.jpg" /></figure><p>If you’re an Android developer, you’ve probably encountered the default crash dialog that pops up whenever your app crashes. It’s basic, uninspiring, and, honestly, doesn’t add much value to your users. But what if you could take control of that experience and replace the default crash dialog with something that enhances the user experience, collects meaningful crash data, and even integrates seamlessly with services like Firebase Crashlytics?</p><p>In this post, I’ll show you how to build your own custom crash UI for Android. This method not only elevates the user experience but also provides the flexibility to send crash reports to Firebase or any other server of your choice. Let’s dive in!</p><h3>Why You Should Replace the Default Crash Dialog</h3><p>Before we dive into the code, let’s talk about why you should even bother replacing the default Android crash dialog:</p><ol><li><strong>Better User Experience</strong>: The default crash dialog is often jarring and doesn’t give users a sense of control or closure. A custom crash UI can look more polished, provide relevant details, and even offer recovery suggestions.</li><li><strong>Meaningful Crash Data</strong>: With a custom crash UI, you have the power to log additional context around the crash — like app state, user actions, device details, etc. — before sending it off to a crash reporting tool like Firebase or Sentry.</li><li><strong>Branding</strong>: A custom UI gives you the opportunity to maintain brand consistency, even during crashes. It’s a small touch that can make your app feel more polished, even when something goes wrong.</li></ol><h3>Setting Up the Custom Crash UI</h3><p>Alright, let’s get into the nitty-gritty of implementing your custom crash UI.</p><h4>Step 1: Add the JitPack Repository</h4><p>First, you’ll need to add the <strong>JitPack</strong> repository to your project’s settings.gradle file. This will allow you to easily import third-party libraries like ExceptionHandler, which we’ll be using for this solution.</p><pre>dependencyResolutionManagement {<br>    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)<br>    repositories {<br>        google()<br>        mavenCentral()<br>        maven { url &#39;https://jitpack.io&#39; } // Add this<br>    }<br>}</pre><h4>Step 2: Add the Dependency</h4><p>Next, add the ExceptionHandler library as a dependency in your build.gradle file. This library helps handle uncaught exceptions and launch your custom crash UI.</p><pre>dependencies {<br>    implementation &#39;com.github.niraj-prajapati:ExceptionHandler:1.0.0&#39;<br>}</pre><h4>Step 3: Create Your Custom Crash Activity</h4><p>Now, let’s create the custom crash UI. For this example, let’s call the activity CrashActivity.kt.</p><p>This activity will be launched when the app crashes. Inside this activity, you can display relevant error information and even send it to Firebase Crashlytics.</p><pre>class CrashActivity : AppCompatActivity() {<br><br>    override fun onCreate(savedInstanceState: Bundle?) {<br>        super.onCreate(savedInstanceState)<br><br>        // Extract the throwable (crash data) from the intent<br>        ExceptionHandler.getThrowableFromIntent(intent).let {<br>            Log.e(&quot;TAG&quot;, &quot;Error Data: &quot;, it)<br>            // Example of sending the error report to Firebase Crashlytics<br>            // FirebaseCrashlytics.getInstance().recordException(throwable)<br>        }<br><br>        // Display your custom crash UI (replace this with your layout)<br>        setContentView(R.layout.activity_crash)<br><br>        // You can also add a button to allow users to send the crash report<br>        // or try reloading the app, etc.<br>    }<br>}</pre><p>Here, we’re logging the error data and setting the content view to a custom layout that you can design according to your app’s branding.</p><h4>Step 4: Initialize the Exception Handler</h4><p>Finally, you need to initialize the ExceptionHandler in your Application class (e.g., App.kt). This ensures that uncaught exceptions will trigger the custom crash activity instead of the default Android crash dialog.</p><pre>class App : Application() {<br><br>    override fun onCreate() {<br>        super.onCreate()<br>        <br>        // Initialize the ExceptionHandler with the CrashActivity class<br>        ExceptionHandler.initialize(this, CrashActivity::class.java)<br>    }<br>}</pre><h3>Bonus: Integrating Firebase Crashlytics</h3><p>To make the most of your custom crash UI, I recommend integrating Firebase Crashlytics to collect crash reports and insights about your app’s stability. Firebase gives you valuable information like crash frequency, device data, and even stack traces.</p><p>You can easily send the caught exception to Firebase by including the following line inside your CrashActivity:</p><pre>FirebaseCrashlytics.getInstance().recordException(throwable)</pre><p>This will allow Firebase to log the crash and display it in the Firebase Console, where you can track issues and fix them faster.</p><h3>Advanced Customization Ideas</h3><p>Once you have the basic implementation working, you can take it further with some advanced customizations:</p><ol><li><strong>Add Animations</strong>: Make the crash screen visually engaging with subtle animations that smooth the transition when the crash occurs. You can use Lottie animations or simple ViewPropertyAnimator to animate the UI elements.</li><li><strong>Crash Report Forms</strong>: If you want more granular data, include a simple form on the crash UI where users can submit additional information about what they were doing before the crash.</li><li><strong>User Feedback</strong>: Consider adding a button that lets users send feedback or suggestions directly from the crash screen. This can be valuable for improving your app over time.</li></ol><h3>Conclusion: Why a Custom Crash UI Matters</h3><p>By replacing the default Android crash dialog with your own custom UI, you take control of the user experience — even during app failures. With a well-designed crash UI, you can:</p><ul><li>Collect more meaningful crash data.</li><li>Improve the overall user experience.</li><li>Offer additional functionalities, such as reporting or retry options.</li></ul><p>This may seem like a small change, but it can have a big impact on how users perceive your app. And with the integration of crash reporting tools like Firebase, you’ll have the insights you need to fix bugs and improve app stability over time.</p><h3>Next Steps</h3><p>Now that you know how to build and customize your own crash UI, why not try it out in your own Android app? You can easily integrate it, collect crash reports, and keep improving the user experience.</p><p>Let me know how it works for you or if you have any questions in the comments!</p><h3>Enjoyed this article?</h3><p>If you found this guide helpful, don’t forget to give it a clap! Your support helps me create more useful content like this. 👏</p><h3>Support My Work</h3><p>If you’d like to support me and my work, feel free to <a href="http://buymeacoffee.com/niraj06081P">Buy Me A Coffee</a>. Your support helps me continue writing more articles like this one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f885489da2ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Android App Publishing on Play Store using GitHub Actions]]></title>
            <link>https://medium.com/@niraj_prajapati/automate-android-app-publishing-on-play-store-using-github-actions-554de7801c36?source=rss-6134755863e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/554de7801c36</guid>
            <category><![CDATA[automated-deployment]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[andorid]]></category>
            <category><![CDATA[play-store]]></category>
            <dc:creator><![CDATA[Niraj Prajapati]]></dc:creator>
            <pubDate>Sun, 28 Jun 2020 06:53:01 GMT</pubDate>
            <atom:updated>2026-07-03T17:23:01.985Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, I’ll show how I managed to automate android app publishing on Play Store.</p><p><strong>I had ZERO knowledge about CI/CD before I tried this.😅</strong></p><p>I tried a couple of plugins like Fastlane, CircleCi, Triple-T, but I found GitHub Actions super easy(At-least for me 😉).</p><p>You can find more details about Github Actions <a href="https://github.com/features/actions">here</a>.</p><p>I’ll cover the following steps:</p><ul><li>Checkout</li><li>Set up JDK 1.8</li><li>Build with Gradle</li><li>Run Unit tests(Optional)</li><li>Build Release Bundle(AAB)</li><li>Sign Bundle</li><li>Upload Bundle(Optional)</li><li>Prepare Play Store Service Account</li><li>Deploy to Play Store</li><li>Notify Build status on Slack(Optional)</li></ul><p>Before you start, here are some basic Workflow syntaxes that I have used.</p><ul><li>name — full name of your workflow.</li><li>on— name of the GitHub event that triggers the workflow.</li><li>jobs — jobs to be run. We’ll use build in our example.</li></ul><p>You can find more syntaxes <a href="https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions">here</a>.</p><h3><strong>Step 1: Checkout</strong></h3><p>This action checks-out your repository under $GITHUB_WORKSPACE so your workflow can access it.</p><pre>- name: Checkout<br>  uses: actions/checkout@v2</pre><p>Refer to the following repo for details.</p><p><a href="https://github.com/actions/checkout">GitHub - actions/checkout: Action for checking out a repo</a></p><h3><strong>Step 2: Set up JDK 1.8</strong></h3><p>Here, the goal is simple. To set up a JDK version to Java 8.</p><pre>- name: set up JDK 1.8<br>  uses: actions/setup-java@v1<br>  with:<br>    java-version: 1.8</pre><blockquote>We’ll use id for steps for which we want status to be reported in slack notification.</blockquote><h3><strong>Step 3: Build with Gradle</strong></h3><p>Build your app with Gradle. It is the same command you use in your terminal to build the project.</p><pre>- name: Build with Gradle<br>  id: build<br>  run: ./gradlew build</pre><h3><strong>Step 4: Run Unit tests</strong></h3><p>It runs unit tests located in the project. You can skip this step if you have not written any tests.</p><pre>- name: Unit tests<br>  id: tests<br>  run: ./gradlew test</pre><h3><strong>Step 5: Build Release Bundle(AAB)</strong></h3><p>Time to build your release bundle. You can also build APK with assembleRelease command if you want. But I prefer bundle to optimize app size.</p><p>Here are some benefits of Android App Bundle over APK on the app store</p><ul><li>Smaller Download Size</li><li>On-Demand App features</li><li>Asset-only modules</li></ul><pre>- name: Build Release AAB<br>  id: buildRelease<br>  run: ./gradlew bundleRelease</pre><p>More information on App Bundles is <a href="https://developer.android.com/guide/app-bundle">available here</a>.</p><h3><strong>Step 6: Sign Bundle</strong></h3><p>Here the part comes when we will sign our generated bundle. For signing bundle, we’ll need</p><ul><li>KeyStore</li><li>Alias</li><li>KeyStore Password</li><li>Key Password</li></ul><p>If you don’t have one already, you can refer to <a href="https://developer.android.com/studio/publish/app-signing#generate-key">Generate an upload key and Keystore</a> to create one.</p><p>To use these keys from the workflow, we’ll add it to <strong>GitHub Secrets</strong>. So it’ll not be exposed. To add Secrets, open your repository and go to <strong>Settings</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*Q594-fhQb_NU2LMqKjJALw.png" /><figcaption>Settings from your Repository</figcaption></figure><p>Now click on Secrets from left panel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*h0JgUEnSPmYVOpxqIB20yA.png" /><figcaption>Secrets from the settings panel</figcaption></figure><p>Then click on <strong>New Secret</strong> to add a new secret value.</p><p>Here for the KeyStore file, we need to upload base64 value. I use this <a href="https://8gwifi.org/Base64Functions.jsp">link</a> to generate base64 from the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ElYeG7GVoO2qkwnSY_NVsQ.png" /><figcaption>Add a new Secret</figcaption></figure><p>Add the following Secrets in your repository</p><ul><li>SIGNING_KEY — base64 text of your Keystore file</li><li>ALIAS — your alias name</li><li>KEY_STORE_PASSWORD — password of your Keystore</li><li>KEY_PASSWORD — your key password</li></ul><pre>- name: Sign AAB<br>  id: sign<br>  uses: r0adkll/sign-android-release@v1<br>  with:<br>    releaseDirectory: app/build/outputs/bundle/release<br>    signingKeyBase64: ${{ secrets.SIGNING_KEY }}<br>    alias: ${{ secrets.ALIAS }}<br>    keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}<br>    keyPassword: ${{ secrets.KEY_PASSWORD }}</pre><p>Refer to the following repo for details about this action.</p><p><a href="https://github.com/r0adkll/sign-android-release">r0adkll/sign-android-release</a></p><h3><strong>Step 7: Upload Artifact</strong></h3><p>This step is also optional. it is not needed until you need to download that build.</p><pre>- name: Upload AAB<br>  id: uploadArtifact<br>  uses: actions/upload-artifact@v1<br>  with:<br>      name: app<br>      path: app/build/outputs/bundle/release/app-release.aab</pre><p>It’ll upload your signed bundle and shown as an artifact. you can download it from there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*bKS4up4l0GpngBfRkWdABA.png" /><figcaption>Uploaded Artifact</figcaption></figure><h3><strong>Step 8: Prepare Play Store Service Account</strong></h3><p>You’ll need a service account to publish the app on the Play Store automatically. If you already have a service account, download the JSON file, copy all content, and paste in Secrets.</p><p>Add the following Secret in your repository</p><ul><li>SERVICE_ACCOUNT_JSON — content of JSON file</li></ul><pre>- name: Create service_account.json<br>  id: createServiceAccount<br>  run: echo &#39;${{ secrets.SERVICE_ACCOUNT_JSON }}&#39; &gt; service_account.json</pre><p>If you don’t have a service account, follow the below steps to create one.</p><ul><li>Login with Owner account to Google Play</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*onJVnY0P6spYeiX2N7Zt0g.png" /></figure><ul><li>Open ‘Settings’&gt;’API access’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*zJ1OSNZ1_xaCnKb0VoPeXw.png" /></figure><ul><li>Click ‘Create new project’ (if not created earlier)</li><li>Click ‘Create Service Account’</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*qapgXN3kIdrSmmGKfgvYgQ.png" /></figure><ul><li>Click Navigate to the Google API Console.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*vU8vyuq6cFNAyhV_tzVndA.png" /></figure><ul><li>Click ‘Create Service Account’ at Google API Console.</li><li>Enter in ‘Service account name’ field the name of the account.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYxabRX_gBnnteJqyb605A.png" /></figure><ul><li>Click ‘Create’.</li><li>Save downloaded JSON file.</li><li>Return back to Google Play console.</li><li>Click ‘Done’ and ensure the new service account appears in the list.</li><li>Click the ‘Grant Access’ button.</li><li>Choose ‘Release Manager’ in ‘Role’ dropdown (probably is already selected by default).</li><li>Set ‘Never’ in ‘Access expire date’ (should be selected by default).</li></ul><h3>Step 9: Deploy to Play Store</h3><p>This action will help you upload an Android .apk or .aab file to the Google Play Console using the Google Play Developer API v3.</p><pre>- name: Deploy to Play Store (BETA)<br>  id: deploy<br>  uses: r0adkll/upload-google-play@v1<br>  with:<br>    serviceAccountJson: service_account.json<br>    packageName: com.package<br>    releaseFile: app/build/outputs/bundle/release/app-release.aab<br>    track: beta<br>    whatsNewDirectory: whatsnew/</pre><p>Refer to the following repo for details about this action.</p><p><a href="https://github.com/r0adkll/upload-google-play">GitHub - r0adkll/upload-google-play: A GitHub action to upload an Android .apk or .aab file to the Google Play Console</a></p><h3>Step 10: Notify Build status on Slack</h3><p>We’ll now send notification about the build status of each job and steps to Slack. This action will include the status of all steps where we have defined id.</p><p>We need to set an environment variable for a Slack webhook URL to send a message. Add env before starting steps</p><pre>env:<br>  SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}</pre><p>and the following action to send a message.</p><pre>- name: Notify on Slack<br>  uses: act10ns/slack@v1<br>  with:<br>    status: ${{ job.status }}<br>    steps: ${{ toJson(steps) }}<br>  if: always()</pre><p>If you don’t know about Slack Webhook, check <a href="https://api.slack.com/messaging/webhooks">this</a>.</p><p>Refer to the following repo for details about this action.</p><p><a href="https://github.com/act10ns/slack">act10ns/slack</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*0-VgTtfY211h1kMM.gif" /></figure><p>Congrats, you are done with the automating of the app publishing process.</p><h3>🚀EXTRA is always GOOD</h3><p>I use <strong>two</strong> workflows to manage my projects.</p><ol><li><strong>On Push CI</strong> — When pushed in any branch except master, I only need to Build it with Gradle.</li><li><strong>Deploy App CI </strong>— When pushed to master or any PR is merged to master, I need to deploy the app.</li></ol><p>Here are the workflows I use.</p><blockquote>I haven’t written any unit tests and I didn’t need artifact so I have skipped that steps in following gist. You can get that code above if needed.</blockquote><h4>On Push CI</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7d707d5a8794e204e7502be3ba283983/href">https://medium.com/media/7d707d5a8794e204e7502be3ba283983/href</a></iframe><h4>Deploy App CI</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/931ef96f9b818660f00f5e10431c82ad/href">https://medium.com/media/931ef96f9b818660f00f5e10431c82ad/href</a></iframe><p>Here is how Slack&#39;s message looks like for both workflows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*fm0RZRsnmFIHZq4kU0M6yg.png" /></figure><blockquote>You can find more actions in the <a href="https://github.com/marketplace?type=actions">marketplace</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=554de7801c36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FaceView]]></title>
            <link>https://medium.com/@niraj_prajapati/faceview-63238f6624cc?source=rss-6134755863e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/63238f6624cc</guid>
            <category><![CDATA[imageview]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[google-vision-api]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[libraries]]></category>
            <dc:creator><![CDATA[Niraj Prajapati]]></dc:creator>
            <pubDate>Fri, 27 Mar 2020 16:43:28 GMT</pubDate>
            <atom:updated>2020-05-15T02:43:23.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>FaceView is a zoom library to face for Android made using Google Vision Library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/0*uai_86WNFPxRkUSv" /></figure><h3>How to get?</h3><h4>Step 1.</h4><p>Add the JitPack repository to your build file<br>Add it to your root build.gradle at the end of repositories:</p><pre>allprojects {<br>    repositories {<br>        ...<br>        maven { url &#39;<a href="https://jitpack.io&/#39;">https://jitpack.io&#39;</a> }<br>    }<br>}</pre><h4>Step 2.</h4><p>Add the dependency</p><pre>dependencies {<br>    implementation &#39;com.github.NAndroidEx:FaceView:1.0.0&#39;<br>}</pre><h3>How to use it?</h3><h4>XML</h4><pre>&lt;com.nandroidex.faceview.FaceView<br>    android:id=&quot;@+id/fvFace&quot;<br>    android:layout_width=&quot;150dp&quot;<br>    android:layout_height=&quot;150dp&quot;<br>    app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>    app:layout_constraintEnd_toEndOf=&quot;parent&quot;<br>    app:layout_constraintStart_toStartOf=&quot;parent&quot;<br>    app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;</pre><h4>Params</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*bFqjWg3u6L9faLfs_G8KpA.png" /></figure><h4>Kotlin</h4><pre>fvFace.setImageResource(R.drawable.rock)<br>//or<br>fvFace.setImageResource(R.drawable.rock)<br>//or<br>fvFace.setImageDrawable(ActivityCompat.getDrawable(this, R.drawable.rock))<br>//or<br>fvFace.setImageBitmap(BitmapFactory.decodeResource(resources,R.drawable.rock))<br>//or<br>Glide.with(this).load(R.drawable.rock).into(fvFace)</pre><blockquote>do not use android:src=”image”, use on your code.</blockquote><h4>Your contributions are welcome.</h4><h3>Demo App</h3><p>I have prepared a <a href="https://github.com/NAndroidEx/FaceView">Demo App</a> for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63238f6624cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UPI Payments]]></title>
            <link>https://medium.com/@niraj_prajapati/upi-payments-9bd35431a171?source=rss-6134755863e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bd35431a171</guid>
            <category><![CDATA[upi-payment-app]]></category>
            <category><![CDATA[android-libraries]]></category>
            <category><![CDATA[upi-payment]]></category>
            <category><![CDATA[upi]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Niraj Prajapati]]></dc:creator>
            <pubDate>Fri, 27 Dec 2019 14:08:01 GMT</pubDate>
            <atom:updated>2020-03-26T14:37:47.984Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*BIy_CblCTVoOl5Zg" /></figure><h3>Introduction</h3><p>I have developed this Android library to easily implement UPI Payment Integration in Android app.</p><ul><li>UPI apps are required to be installed already before using this library because, internally this API calls UPI apps for payment processing.</li><li>Before using it, make sure that your device is having atleast one UPI app installed. Otherwise it will unable to process the payments.</li><li>This API is in beta, there are lot of improvements are still needed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*rc13TqBslxCXnNJb" /></figure><h3>How to get?</h3><p><strong>Step 1.</strong></p><p>Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:</p><pre>allprojects {<br>    repositories {<br>        ...<br>        maven { url &#39;https://jitpack.io&#39; }<br>    }<br>}</pre><p><strong>Step 2.</strong></p><p>Add the dependency</p><pre>dependencies {<br>    implementation &#39;com.github.NAndroidEx:UPIPayments:1.1.3&#39;<br>}</pre><h3>How to use it?</h3><p><strong>Implement PaymentStatusListener and its methods</strong></p><pre>class MainActivity : AppCompatActivity(), PaymentStatusListener {</pre><pre>    ....</pre><pre>    override fun onTransactionCompleted(transactionDetails: TransactionDetails?) {<br>        Log.d(&quot;TransactionDetails&quot;, transactionDetails.toString())<br>        upiPayment.detachListener()<br>    }</pre><pre>    override fun onTransactionSuccess() {<br>        Toast.makeText(this, &quot;Success&quot;, Toast.LENGTH_SHORT).show()<br>    }</pre><pre>    override fun onTransactionSubmitted() {<br>        Toast.makeText(this, &quot;Pending | Submitted&quot;, Toast.LENGTH_SHORT).show()<br>    }</pre><pre>    override fun onTransactionFailed() {<br>        Toast.makeText(this, &quot;Failed&quot;, Toast.LENGTH_SHORT).show()<br>    }</pre><pre>    override fun onTransactionCancelled() {<br>        Toast.makeText(this, &quot;Cancelled&quot;, Toast.LENGTH_SHORT).show()<br>    }</pre><pre>    override fun onAppNotFound() {<br>        Toast.makeText(this, &quot;App Not Found&quot;, Toast.LENGTH_SHORT).show()<br>    }<br>}</pre><p><strong>Initializing UPIPayment :</strong></p><pre>val upiPayment: UPIPayment = UPIPayment.Builder()<br>    .with(this@MainActivity)<br>    .setPayeeVpa(etVPA.text.toString())<br>    .setPayeeName(etName.text.toString())<br>    .setPayeeMerchantCode(etPayeeMerchantCode.text.toString())<br>    .setTransactionId(etTxnId.text.toString())<br>    .setTransactionRefId(etTxnRefId.text.toString())<br>    .setDescription(etDescription.text.toString())<br>    .setAmount(etAmount.text.toString())<br>    .build()</pre><pre>upiPayment.setPaymentStatusListener(this)</pre><pre>if (upiPayment.isDefaultAppExist()) {<br>    onAppNotFound()<br>    return<br>}</pre><pre>upiPayment.startPayment()</pre><p><strong>Calls and Descriptions :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*JCMNS3QtSwOMk3nFU8XKTA.png" /></figure><p><strong>Removing Listener</strong></p><p>To remove listeners, you can invoke detachListener() after the transaction is completed or you haven’t to do with payment callbacks.</p><pre>upiPayment.detachListener()</pre><p><strong>Getting Transaction Details</strong></p><p>To get details about transactions, we have callback method onTransactionCompleted() with parameter of TransactionDetails. TransactionDetails instance includes details about previously completed transaction.<br>To get details, below method of TransactionDetails are useful :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*ZmmH9yF5-B39dob3mTokwA.png" /></figure><p><strong>We have successfully implemented UPI integration in our Android app. Thank You!</strong></p><h3>Demo App</h3><p>I have prepared a <a href="https://github.com/NAndroidEx/UPIPayments">Demo App</a> for you.</p><h3>Your contributions are welcome.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bd35431a171" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firebase Remote Config]]></title>
            <link>https://medium.com/@niraj_prajapati/firebase-remote-config-7cff45794583?source=rss-6134755863e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cff45794583</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[firebase-remote-config]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Niraj Prajapati]]></dc:creator>
            <pubDate>Wed, 25 Dec 2019 13:32:25 GMT</pubDate>
            <atom:updated>2019-12-25T13:32:25.267Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>It helps to change the behavior and appearance of your app without publishing an app update, at no cost, for unlimited daily active users.</strong></p><h3><strong>What is Firebase Remote Config?</strong></h3><p>Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update. When using Remote Config, you create in-app default values that control the behavior and appearance of your app. Then, you can later use the Firebase console or the Remote Config REST API to override in-app default values for all app users or for segments of your user base. Your app controls when updates are applied, and it can frequently check for updates and apply them with a negligible impact on performance.</p><h3>Add Firebase to your app</h3><p>If you haven’t already, <a href="https://firebase.google.com/docs/android/setup">add Firebase to your Android project</a>.</p><p>Add dependency</p><pre>implementation &#39;com.google.firebase:firebase-config:19.0.4&#39;</pre><h3>Demo App</h3><p>I have prepared a <a href="https://github.com/NAndroidEx/Remote-Config-App-Update-Dialog">Demo App</a> for showing update dialog to the user.</p><h3>Open Remote Config in Console, Add needed parameters and publish</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Isj76OOHnwS6XPxL" /></figure><h3>Add default values</h3><p>Create remote_config_defaults.xml file in res&gt;xml folder</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;defaultMap&gt;<br>    &lt;entry&gt;<br>        &lt;key&gt;latestVersion&lt;/key&gt;<br>        &lt;value&gt;1.0&lt;/value&gt;<br>    &lt;/entry&gt;<br>    &lt;entry&gt;<br>        &lt;key&gt;forceUpdate&lt;/key&gt;<br>        &lt;value&gt;false&lt;/value&gt;<br>    &lt;/entry&gt;<br>    &lt;entry&gt;<br>        &lt;key&gt;releaseNotes&lt;/key&gt;<br>        &lt;value&gt;- Feature 1&lt;/value&gt;<br>    &lt;/entry&gt;<br>    &lt;entry&gt;<br>        &lt;key&gt;updateUrl&lt;/key&gt;<br>        &lt;value&gt;https://nandroidex.wordpress.com/&lt;/value&gt;    &lt;!--TODO : PLAY STORE URL--&gt;<br>    &lt;/entry&gt;<br>&lt;/defaultMap&gt;</pre><h3>Fetch values from Firebase</h3><pre>val remoteConfig = FirebaseRemoteConfig.getInstance()<br>val configSettings = FirebaseRemoteConfigSettings.Builder()<br>    .setMinimumFetchIntervalInSeconds(10)<br>    .build()<br>remoteConfig.setConfigSettingsAsync(configSettings)<br>remoteConfig.setDefaultsAsync(R.xml.remote_config_defaults)<br>remoteConfig.fetchAndActivate()</pre><pre>val latestVersion = remoteConfig.getDouble(&quot;latestVersion&quot;)<br>val forceUpdate = remoteConfig.getBoolean(&quot;forceUpdate&quot;)<br>val updateUrl = remoteConfig.getString(&quot;updateUrl&quot;)<br>val releaseNotes = remoteConfig.getString(&quot;releaseNotes&quot;)<br>Log.e(&quot;TAG&quot;, &quot;latestVersion : $latestVersion&quot;)<br>Log.e(&quot;TAG&quot;, &quot;forceUpdate : $forceUpdate&quot;)<br>Log.e(&quot;TAG&quot;, &quot;updateUrl : $updateUrl&quot;)<br>Log.e(&quot;TAG&quot;, &quot;releaseNotes : $releaseNotes&quot;)</pre><h3>Check current app version</h3><pre>try {<br>    val currentVersion = packageManager.getPackageInfo(packageName, 0).versionName<br>} catch (e: PackageManager.NameNotFoundException) {<br>    e.printStackTrace()<br>}</pre><h3>Show dialog if the version is different than the app version</h3><pre>val dialogUpdate = Dialog(this@MainActivity)<br>if (currentVersion.toFloat() != latestVersion.toFloat()) {<br>    dialogUpdate.requestWindowFeature(Window.FEATURE_NO_TITLE)<br>    dialogUpdate.setContentView(R.layout.dialog_update)<br>    dialogUpdate.setCancelable(false)<br>    dialogUpdate.tvReleaseNotes.text = releaseNotes<br>    dialogUpdate.btnUpdate.setOnClickListener {<br>        val intent = Intent(Intent.ACTION_VIEW)<br>        intent.data = Uri.parse(updateUrl)<br>        startActivity(intent)<br>    }<br>    if (forceUpdate) {<br>        dialogUpdate.btnCancel.visibility = INVISIBLE<br>    } else {<br>        dialogUpdate.btnCancel.visibility = VISIBLE<br>    }<br>    dialogUpdate.btnCancel.setOnClickListener {<br>        dialogUpdate.dismiss()<br>    }<br>    dialogUpdate.show()<br>} else {<br>    if (dialogUpdate.isShowing) {<br>        dialogUpdate.dismiss()<br>    }<br>}</pre><h3>Thanks</h3><p><strong>Your contributions are welcome.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cff45794583" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>