<?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 Mohit on Medium]]></title>
        <description><![CDATA[Stories by Mohit on Medium]]></description>
        <link>https://medium.com/@ermohit2k18?source=rss-2de3934ac80b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*q6H8iXto-yVq9NOI</url>
            <title>Stories by Mohit on Medium</title>
            <link>https://medium.com/@ermohit2k18?source=rss-2de3934ac80b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:52:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ermohit2k18/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[Google Sign-In in React Native with Firebase Authentication (Android & iOS) — Complete Guide]]></title>
            <link>https://medium.com/@ermohit2k18/google-sign-in-in-react-native-with-firebase-authentication-android-ios-complete-guide-b9c621de9749?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9c621de9749</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 10:00:23 GMT</pubDate>
            <atom:updated>2026-07-31T10:00:23.401Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Authentication</strong> is one of the first features users interact with in any application, and providing a seamless login experience can significantly improve user onboarding. Instead of asking users to create yet another username and password, Google Sign-In allows them to authenticate with an account they already trust.</p><p>When combined with <strong>Firebase Authentication</strong>, Google Sign-In becomes a secure, scalable, and easy-to-implement solution that works across both Android and iOS.</p><p>In this article, we’ll integrate <strong>Google Sign-In</strong> into a React Native application using <strong>React Native Firebase Authentication</strong> and the <strong>@react-native-google-signin/google-signin</strong> package. We’ll also cover the configuration steps, explain why the <strong>Web Client ID</strong> is required, and look at some of the most common issues developers encounter during setup.</p><p>By the end of this guide, you’ll have a production-ready Google authentication flow that works on both Android and iOS.</p><h3>Before You Begin</h3><p>This guide assumes you’ve already configured Firebase in your React Native project.</p><p>If you haven’t completed the initial setup yet, you can follow my previous guides first:</p><ul><li><a href="https://medium.com/@ermohit2k18/firebase-setup-in-react-native-for-beginners-step-by-step-guide-ec5f9150bc24">🚀 Firebase Setup in React Native</a></li><li><a href="https://medium.com/@ermohit2k18/implement-firebase-email-password-authentication-in-react-native-production-ready-setup-7e15812fe633">📧 Email &amp; Password Authentication</a></li><li><a href="https://medium.com/@ermohit2k18/implement-firebase-phone-authentication-in-react-native-otp-login-production-ready-guide-f3da6d996812">📱 Phone Authentication</a></li><li><a href="https://medium.com/@ermohit2k18/implement-firebase-anonymous-authentication-guest-login-in-react-native-production-ready-guide-04e1de70cde9">👤 Anonymous Authentication</a></li></ul><p>These articles cover everything from creating a Firebase project to configuring Android and iOS applications.</p><h3>What You’ll Build</h3><p>By the end of this article, you’ll be able to:</p><ul><li>Authenticate users using their Google account.</li><li>Sign users into Firebase Authentication.</li><li>Retrieve the authenticated user’s profile information.</li><li>Sign users out from both Google and Firebase.</li><li>Handle common Google Sign-In errors.</li><li>Build a production-ready authentication flow.</li></ul><h3>Installing Dependencies</h3><p>We’ll use two libraries:</p><ul><li><strong>@react-native-firebase/auth</strong> — Handles Firebase Authentication.</li><li><strong>@react-native-google-signin/google-signin</strong> — Handles Google’s native sign-in flow.</li></ul><p>Install them using yarn/npm:</p><pre>yarn add @react-native-firebase/auth<br>yarn add @react-native-google-signin/google-signin</pre><p>For iOS, install the CocoaPods dependencies:</p><pre>cd ios<br>pod install</pre><p>Once the installation is complete, we’re ready to configure Firebase Authentication.</p><h3>Enable Google Authentication in Firebase</h3><p>Before writing any code, Google Sign-In must be enabled inside your Firebase project.</p><p>Open the <strong>Firebase Console</strong> and navigate to:</p><pre>Authentication<br>    ↓<br>Sign-in Method<br>    ↓<br>  Google</pre><p>Enable the Google provider and save the changes.</p><p>That’s all that’s required from the Firebase Console. Since Firebase is already configured in our project, there’s no need to repeat the initial setup steps here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bW34dgC0ItCkgcXGsvRDnQ.png" /><figcaption>firebase console for authentication</figcaption></figure><h3>Understanding OAuth Client IDs</h3><p>This is one of the most confusing parts of implementing Google Sign-In, and it’s also where many developers get stuck.</p><p>When you enable Google Authentication, Firebase automatically creates multiple OAuth Client IDs:</p><ul><li>Android Client ID</li><li>iOS Client ID</li><li>Web Client ID</li></ul><p>At first glance, it seems logical to use the Android Client ID because our application is running on Android. However, that’s not how Firebase Authentication works.</p><p>The Google Sign-In SDK needs the <strong>Web Client ID</strong> to request an <strong>ID Token</strong>. Firebase then verifies this ID Token before authenticating the user.</p><p>Using the Android Client ID inside your React Native code will usually result in authentication errors such as:</p><ul><li>DEVELOPER_ERROR</li><li>12500</li><li>INVALID_IDP_RESPONSE</li></ul><p>The correct client to use is always the <strong>Web Client ID</strong>.</p><p>You can find it by navigating to:</p><pre>Firebase Console<br>    ↓<br>Authentication<br>    ↓<br>Sign-in Method<br>    ↓<br>  Google<br>    ↓<br>Web Sdk Configuration<br>    ↓<br>Web Client ID</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rI70dBTM8l7c6lqqLQmKQ.png" /><figcaption>Web Client ID from google auth</figcaption></figure><p>Alternatively, you can find it in the Google Cloud Console under:</p><pre>APIs &amp; Services<br>    ↓<br>Credentials</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_UvJqPgPsbsErYMcCWAkg.png" /><figcaption>Web client ID from Google Cloud Console</figcaption></figure><h3>Understanding Each OAuth Client</h3><p>Let’s briefly understand what each OAuth Client actually does.</p><h3>Android Client ID</h3><p>The Android OAuth Client identifies your Android application using:</p><ul><li>Package Name</li><li>SHA-1 fingerprint</li><li>SHA-256 fingerprint</li></ul><p>Firebase automatically uses these details to verify that authentication requests originate from your Android application.</p><p>You <strong>do not</strong> pass the Android Client ID to GoogleSignin.configure().</p><h3>iOS Client ID</h3><p>Similarly, the iOS OAuth Client identifies your iOS application using its Bundle Identifier.</p><p>Just like Android, you don’t use this Client ID inside your React Native code.</p><h3>Web Client ID</h3><p>This is the Client ID that the Google Sign-In SDK uses to request an <strong>ID Token</strong>.</p><p>Firebase verifies this token before signing the user into your application.</p><p>That’s why you’ll configure Google Sign-In like this:</p><pre>import { GoogleSignin } from &#39;@react-native-google-signin/google-signin&#39;;</pre><pre>GoogleSignin.configure({<br>  webClientId: &#39;YOUR_WEB_CLIENT_ID&#39;,<br>});</pre><p>A simple way to remember this is:</p><blockquote>Android and iOS Client IDs identify your application, while the Web Client ID identifies the authentication request sent to Firebase.</blockquote><h3>Configure SHA Fingerprints (Android)</h3><p>Before Google can authenticate users, it needs to verify that authentication requests are coming from your Android application.</p><p>This verification is performed using your application’s <strong>SHA fingerprints</strong>.</p><p>Generate them using the following command:</p><pre>keytool -list -v \<br>-alias androiddebugkey \<br>-keystore ~/.android/debug.keystore</pre><p>The default password is:</p><pre>android</pre><p>Copy both fingerprints:</p><ul><li>SHA-1</li><li>SHA-256</li></ul><p>Now open Firebase Console and navigate to:</p><pre>Project Settings<br>    ↓<br>Android App<br>    ↓<br>SHA Certificate Fingerprints</pre><p>Add both fingerprints and save the changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9DxDcaVlw8XD_qz2GJcJQ.png" /><figcaption>Add SHA keys here in the Add Fingerprint</figcaption></figure><p>Without these fingerprints, Google Sign-In won’t be able to verify your application, and authentication will fail.</p><h3>Download the Updated google-services.json</h3><p>After adding the SHA fingerprints, Firebase regenerates your Android configuration.</p><p>Download the updated google-services.json file and replace the existing one inside your project:</p><pre>android/app/google-services.json</pre><p>Failing to replace the configuration file after adding SHA fingerprints is another common reason why Google Sign-In doesn’t work as expected.</p><h3>Android Checklist ✅</h3><p>Before moving on, make sure you’ve completed the following:</p><ul><li>✔ Google Authentication enabled in Firebase</li><li>✔ SHA-1 added</li><li>✔ SHA-256 added</li><li>✔ Updated google-services.json downloaded</li><li>✔ Web Client ID copied</li></ul><p>Once all of these are in place, the Android configuration is complete.</p><h3>iOS Configuration</h3><p>Configuring Google Sign-In on iOS requires a couple of additional steps compared to Android. These steps allow iOS to redirect the user back to your application after Google authentication is completed.</p><p>If you’ve already completed the Firebase setup from my previous article, you should already have the <strong>GoogleService-Info.plist</strong> file inside your iOS project.</p><p>If not, download it from the Firebase Console and drag it into your Xcode project.</p><blockquote>For ref you can check earlier firebase set up article <a href="https://medium.com/@ermohit2k18/firebase-setup-in-react-native-for-beginners-step-by-step-guide-ec5f9150bc24">here</a></blockquote><h3>Configure URL Types</h3><p>Open your project in <strong>Xcode</strong> and navigate to:</p><pre>Target<br>  ↓<br> Info<br>  ↓<br>URL Types</pre><p>Click the <strong>+</strong> button to add a new URL Type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJIACRFdmcHUmcvetRgtyg.png" /><figcaption>Url Types in Xcode</figcaption></figure><p>You get this from Google Cloud Console:</p><pre>Credentials<br>    ↓<br>OAuth 2.O Client Id<br>    ↓<br>iOS Client<br>    ↓<br>Url Schemes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4QeM8vjMBIsluP8ieFUwg.png" /><figcaption>Credentials in Google Cloud Console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZIv1xzNgJHSJ1alQK1_SA.png" /><figcaption>Client ID for iOS , here you get the URL scheme</figcaption></figure><p>Copy the value and paste it into the <strong>URL Schemes</strong> field.</p><p>Your configuration should look similar to this:</p><pre>Identifier:<br>Google</pre><pre>URL Schemes:<br>com.googleusercontent.apps.xxxxxxxxxxxxxxxxx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2oVyDBHPVrUlgkLVuhCN3A.png" /><figcaption>Add the details in the Xcode</figcaption></figure><p>This allows iOS to return the user to your application after completing the Google authentication flow.</p><h3>Configure Google Sign-In</h3><p>Before we can authenticate users, we need to configure the Google Sign-In SDK.</p><p>I recommend doing this once during application startup instead of configuring it every time the login screen is opened.</p><p>For example, you can configure it inside your App.tsx, a separate initialization file, or your authentication provider.</p><pre>import { GoogleSignin } from &#39;@react-native-google-signin/google-signin&#39;;<br><br>GoogleSignin.configure({<br>  webClientId:<br>    &#39;YOUR_WEB_CLIENT_ID&#39;,<br>});</pre><p>Replace <strong>YOUR_WEB_CLIENT_ID</strong> with the Web Client ID you copied from the Firebase Console.</p><p>That’s all the configuration required.</p><h3>Why is the Web Client ID Required?</h3><p>This is probably the most common question developers have while implementing Google Sign-In.</p><p>Firebase creates multiple OAuth Client IDs:</p><ul><li>Android Client ID</li><li>iOS Client ID</li><li>Web Client ID</li></ul><p>Many developers assume that because they’re building an Android application, they should use the Android Client ID.</p><p>Unfortunately, that’s incorrect.</p><p>The Google Sign-In SDK requests an <strong>ID Token</strong>, and Firebase only accepts an ID Token that has been generated using the <strong>Web OAuth Client</strong>.</p><p>Think of it like this:</p><ul><li><strong>Android Client ID</strong> identifies your Android application.</li><li><strong>iOS Client ID</strong> identifies your iOS application.</li><li><strong>Web Client ID</strong> identifies the authentication request made to Firebase.</li></ul><p>That’s why your configuration should always look like this:</p><pre>GoogleSignin.configure({<br>  webClientId: &#39;YOUR_WEB_CLIENT_ID&#39;,<br>});</pre><p>Using the Android Client ID here is one of the most common causes of authentication failures.</p><h3>Implement Google Sign-In</h3><p>Now comes the fun part — implementing the authentication flow.</p><p>We’ll start by checking whether Google Play Services are available.</p><p>Then we’ll open Google’s authentication screen.</p><p>After the user successfully signs in, we’ll obtain the <strong>ID Token</strong>, create a Firebase credential, and finally authenticate the user with Firebase.</p><pre>import { View } from &#39;react-native&#39;;<br>import React from &#39;react&#39;;<br>import {<br>  GoogleSignin,<br>  GoogleSigninButton,<br>  statusCodes<br>} from &#39;@react-native-google-signin/google-signin&#39;;<br>import { signInWithCredential, GoogleAuthProvider, getAuth } from &#39;@react-native-firebase/auth&#39;;<br><br>const signInWithGoogle = async () =&gt; {<br>  try {<br>    await GoogleSignin.hasPlayServices({ showPlayServicesUpdateDialog: true });<br>    const response = await GoogleSignin.signIn();<br>    const idToken = response.data?.idToken;<br>    if (!idToken) {<br>      throw new Error(&#39;Failed to retrieve ID Token.&#39;);<br>    }<br>    const googleCredential = GoogleAuthProvider.credential(idToken,idToken);<br>    const userCredential = await signInWithCredential(getAuth(), googleCredential);<br>    console.log(&#39;User signed in with Google:&#39;, userCredential);<br>    return userCredential;<br>  } catch (error: any) {<br>    if (error.code === statusCodes.SIGN_IN_CANCELLED) {<br>      console.log(&#39;User cancelled the login flow&#39;);<br>    } else if (error.code === statusCodes.IN_PROGRESS) {<br>      console.log(&#39;Sign in is already in progress&#39;);<br>    } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {<br>      console.log(&#39;Play services not available or outdated&#39;);<br>    } else {<br>      console.error(&#39;Google Sign-In Error:&#39;, error);<br>    }<br>  }<br>};<br><br>export default function Login() {<br><br>  return (<br>    &lt;View&gt;<br>      &lt;GoogleSigninButton<br>        size={GoogleSigninButton.Size.Wide}<br>        onPress={signInWithGoogle}<br>      /&gt;<br>    &lt;/View&gt;<br>  )<br>}</pre><p>That’s it!</p><p>Once the promise resolves, the user is successfully authenticated with Firebase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*hgJohDR1iyTNw4Co94SFmA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*2Y3r3umVfieG3X5MgdYVoQ.png" /><figcaption>OutPut when user tap on the sign in with google</figcaption></figure><h3>Understanding the Authentication Flow</h3><p>Let’s understand what actually happens behind the scenes.</p><p>When the user taps the Google Sign-In button, the Google Sign-In SDK opens Google’s authentication screen.</p><p>After successful authentication, Google returns an <strong>ID Token</strong>.</p><p>We then pass this ID Token to Firebase.</p><p>Firebase verifies the token with Google’s servers.</p><p>If the token is valid, Firebase creates an authenticated user session and returns the logged-in user.</p><p>This process happens in just a few seconds, but understanding the flow makes debugging much easier.</p><pre>User taps Google Sign-In<br>          │<br>          ▼<br>Google Authentication<br>          │<br>          ▼<br>Returns ID Token<br>          │<br>          ▼<br>Firebase Credential<br>          │<br>          ▼<br>Firebase Authentication<br>          │<br>          ▼<br>Authenticated User</pre><h3>Accessing User Information</h3><p>Once the user is authenticated, Firebase stores the current user information.</p><p>You can access it anywhere in your application.</p><pre>const user = auth().currentUser;</pre><pre>console.log(user?.displayName);<br>console.log(user?.email);<br>console.log(user?.photoURL);<br>console.log(user?.uid);</pre><p>Example output:</p><pre>//Home.tsx<br><br>import { Alert, Image, Pressable, StyleSheet, Text, View } from &#39;react-native&#39;;<br>import React from &#39;react&#39;;<br>import { authInstance, handleSignOut } from &#39;../utils/googleSignIn&#39;;<br><br>export default function Home() {<br>  const user:any = authInstance.currentUser;<br>  const displayName = user?.displayName || user?._user?.displayName || &#39;&#39;;<br>  const email = user?.email || user?._user?.email || &#39;&#39;;<br>  const photoURL = user?.photoURL || user?._user?.photoURL || &#39;&#39;;<br>  const uid = user?.uid || user?._user?.uid || &#39;&#39;;<br>  const emailVerified = user?.emailVerified ?? user?._user?.emailVerified;<br>  const provider =<br>    user?.providerData?.[0]?.providerId ||<br>    user?._user?.providerData?.[0]?.providerId ||<br>    &#39;&#39;;<br><br>  const confirmSignOut = () =&gt; {<br>    Alert.alert(&#39;Sign Out&#39;, &#39;Are you sure you want to sign out?&#39;, [<br>      { text: &#39;Cancel&#39;, style: &#39;cancel&#39; },<br>      { text: &#39;Yes&#39;, style: &#39;destructive&#39;, onPress: handleSignOut },<br>    ]);<br>  };<br><br>  return (<br>    &lt;View style={styles.container}&gt;<br>      &lt;View style={styles.profileSection}&gt;<br>        {photoURL ? (<br>          &lt;Image source={{ uri: photoURL }} style={styles.avatar} /&gt;<br>        ) : (<br>          &lt;View style={[styles.avatar, styles.avatarPlaceholder]}&gt;<br>            &lt;Text style={styles.avatarText}&gt;{displayName.charAt(0)}&lt;/Text&gt;<br>          &lt;/View&gt;<br>        )}<br>        &lt;Text style={styles.name}&gt;{displayName}&lt;/Text&gt;<br>        &lt;Text style={styles.email}&gt;{email}&lt;/Text&gt;<br><br>        &lt;View style={styles.infoCard}&gt;<br>          &lt;View style={styles.infoRow}&gt;<br>            &lt;Text style={styles.infoLabel}&gt;UID&lt;/Text&gt;<br>            &lt;Text style={styles.infoValue} numberOfLines={1}&gt;<br>              {uid}<br>            &lt;/Text&gt;<br>          &lt;/View&gt;<br>          &lt;View style={styles.divider} /&gt;<br>          &lt;View style={styles.infoRow}&gt;<br>            &lt;Text style={styles.infoLabel}&gt;Email Verified&lt;/Text&gt;<br>            &lt;Text style={styles.infoValue}&gt;<br>              {emailVerified ? &#39;Yes&#39; : &#39;No&#39;}<br>            &lt;/Text&gt;<br>          &lt;/View&gt;<br>          &lt;View style={styles.divider} /&gt;<br>          &lt;View style={styles.infoRow}&gt;<br>            &lt;Text style={styles.infoLabel}&gt;Provider&lt;/Text&gt;<br>            &lt;Text style={styles.infoValue}&gt;{provider}&lt;/Text&gt;<br>          &lt;/View&gt;<br>        &lt;/View&gt;<br>      &lt;/View&gt;<br><br>      &lt;Pressable style={styles.signOutButton} onPress={confirmSignOut}&gt;<br>        &lt;Text style={styles.signOutText}&gt;Sign Out&lt;/Text&gt;<br>      &lt;/Pressable&gt;<br>    &lt;/View&gt;<br>  );<br>}<br><br>const styles = StyleSheet.create({<br>  container: {<br>    flex: 1,<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    paddingVertical: 60,<br>    paddingHorizontal: 24,<br>    width: &#39;100%&#39;,<br>  },<br>  profileSection: {<br>    alignItems: &#39;center&#39;,<br>    gap: 12,<br>  },<br>  avatar: {<br>    width: 120,<br>    height: 120,<br>    borderRadius: 60,<br>    backgroundColor: &#39;#e0e0e0&#39;,<br>    marginBottom: 16,<br>  },<br>  avatarPlaceholder: {<br>    alignItems: &#39;center&#39;,<br>    justifyContent: &#39;center&#39;,<br>    backgroundColor: &#39;#4285F4&#39;,<br>  },<br>  avatarText: {<br>    fontSize: 48,<br>    fontWeight: &#39;700&#39;,<br>    color: &#39;#fff&#39;,<br>  },<br>  name: {<br>    fontSize: 24,<br>    fontWeight: &#39;700&#39;,<br>    color: &#39;#1a1a1a&#39;,<br>  },<br>  email: {<br>    fontSize: 16,<br>    color: &#39;#666&#39;,<br>  },<br>  infoCard: {<br>    marginTop: 24,<br>    width: &#39;100%&#39;,<br>    backgroundColor: &#39;#f5f5f5&#39;,<br>    borderRadius: 12,<br>    padding: 16,<br>  },<br>  infoRow: {<br>    flexDirection: &#39;row&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    alignItems: &#39;center&#39;,<br>    paddingVertical: 8,<br>  },<br>  infoLabel: {<br>    fontSize: 14,<br>    color: &#39;#999&#39;,<br>    fontWeight: &#39;500&#39;,<br>  },<br>  infoValue: {<br>    fontSize: 14,<br>    color: &#39;#333&#39;,<br>    fontWeight: &#39;500&#39;,<br>    maxWidth: &#39;60%&#39;,<br>  },<br>  divider: {<br>    height: 1,<br>    backgroundColor: &#39;#e0e0e0&#39;,<br>  },<br>  signOutButton: {<br>    backgroundColor: &#39;#e53935&#39;,<br>    paddingVertical: 14,<br>    paddingHorizontal: 48,<br>    borderRadius: 30,<br>    width: &#39;100%&#39;,<br>    alignItems: &#39;center&#39;,<br>  },<br>  signOutText: {<br>    color: &#39;#fff&#39;,<br>    fontSize: 16,<br>    fontWeight: &#39;600&#39;,<br>  },<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*fN9uyIu7fXklAB787BO-zA.png" /><figcaption>User details from google</figcaption></figure><p>The UID is especially important because it’s unique for every Firebase user and is commonly used when storing user data in Firestore or Realtime Database.</p><h3>Listen for Authentication State Changes</h3><p>Instead of checking whether a user is logged in every time the application opens, Firebase provides a much cleaner approach.</p><p>You can subscribe to authentication state changes using onAuthStateChanged.</p><pre>useEffect(() =&gt; {<br>  const subscriber = auth().onAuthStateChanged(user =&gt; {<br>    if (user) {<br>      console.log(&#39;User is logged in&#39;);<br>    } else {<br>      console.log(&#39;User is logged out&#39;);<br>    }<br>  });<br>  return subscriber;<br>}, []);</pre><p>Whenever the user’s authentication state changes, Firebase automatically notifies your application.</p><p>This makes it very easy to switch between your authentication screens and your main application without manually checking login status.</p><h3>Signing Out</h3><p>Signing out involves two steps. <br>First, disconnect the Google session.<br>Then sign out from Firebase.</p><pre>const handleSignOut = async () =&gt; {<br>    try {<br>      await GoogleSignin.revokeAccess();<br>      await signOut(getAuth());<br>    } catch (error) {<br>      console.error(&#39;Sign out error:&#39;, error);<br>    }<br>  };</pre><p>If you only call <strong>signOut(getAuth())</strong>, the Firebase session ends, but the Google account may remain connected. Calling both methods ensures the user is fully signed out and will be prompted to choose an account the next time they sign in.</p><p>At this point, your Google Sign-In flow is fully functional on both Android and iOS.</p><p>Awesome! This is the final part of the article. This is also the section that differentiates your article from the dozens of Google Sign-In tutorials already on Medium. Most articles stop after the implementation, but developers usually spend more time debugging configuration issues than writing the actual code.</p><h3>Common Errors and Solutions</h3><p>Even after following all the setup steps correctly, you may still encounter errors during authentication. Fortunately, most of these errors are configuration-related and can be resolved quickly once you understand their cause.</p><p>Let’s look at the most common issues and how to fix them.</p><h3>DEVELOPER_ERROR</h3><p>This is by far the most common error developers encounter while implementing Google Sign-In.<br>Unfortunately, the error message itself isn’t very descriptive, but it usually points to an issue with your project configuration.</p><h3>Possible Causes</h3><ul><li>Missing SHA-1 fingerprint.</li><li>Missing SHA-256 fingerprint.</li><li>Incorrect package name.</li><li>Wrong Web Client ID.</li><li>Using an outdated google-services.json</li></ul><h3>How to Fix It</h3><p>✔ Verify that both <strong>SHA-1</strong> and <strong>SHA-256</strong> fingerprints have been added to Firebase.</p><p>✔ Ensure your application’s package name matches the one registered in Firebase.</p><p>✔ Replace your google-services.json after adding SHA fingerprints.</p><p>✔ Double-check that you’re using the <strong>Web Client ID</strong>, not the Android Client ID.</p><h3>Error Code 12500</h3><p>Another frequently reported issue is: 12500 <br>This usually indicates an OAuth configuration problem.</p><h3>Possible Causes</h3><ul><li>Google Sign-In isn’t enabled in Firebase Authentication.</li><li>Incorrect OAuth Client.</li><li>OAuth Consent Screen isn’t configured correctly.</li><li>Web Client ID doesn’t belong to the current Firebase project.</li></ul><h3>Solution</h3><p>Open the Firebase Console and verify:</p><ul><li>Google Authentication is enabled.</li><li>You’re using the correct Web Client ID.</li><li>Your OAuth Client belongs to the same Firebase project.</li></ul><h3>PLAY_SERVICES_NOT_AVAILABLE</h3><p>Google Sign-In depends on Google Play Services.</p><p>If Google Play Services are missing or outdated, authentication cannot proceed.</p><p>Always verify Play Services before attempting to sign in.</p><pre>await GoogleSignin.hasPlayServices();</pre><p>If Play Services aren’t available, prompt the user to update them from the Play Store.</p><p>This issue is mostly seen on:</p><ul><li>Older Android devices</li><li>Emulators without Google APIs</li><li>Devices running custom ROMs</li></ul><h3>SIGN_IN_CANCELLED</h3><p>This isn’t actually an error.</p><p>It simply means the user closed the Google Sign-In screen before completing authentication.</p><p>For example:</p><ul><li>User taps the Back button.</li><li>User closes the Google account picker.</li><li>User decides not to continue.</li></ul><p>Instead of showing an error dialog, simply ignore this scenario or display a friendly message if appropriate.</p><h3>NETWORK_ERROR</h3><p>This occurs when the device cannot communicate with Google’s authentication servers.</p><p>Common reasons include:</p><ul><li>No internet connection.</li><li>Poor network connectivity.</li><li>Firewall or VPN restrictions.</li><li>Temporary Google service issues.</li></ul><p>Before initiating authentication, it’s always a good idea to verify network connectivity.</p><p>If authentication fails because of a network issue, allow the user to retry rather than immediately displaying a failure screen.</p><h3>Production Best Practices</h3><p>Once Google Sign-In is working, there are a few best practices that will make your implementation more robust and easier to maintain.</p><h3>Configure Google Sign-In Only Once</h3><p>Avoid calling GoogleSignin.configure() every time the login screen is opened.</p><p>Instead, configure it once during application startup.</p><p>Good places include:</p><ul><li>App.tsx</li><li>Authentication Provider</li><li>App initialization module</li></ul><p>Repeated configuration isn’t necessary and can make your authentication flow harder to manage.</p><h3>Listen for Authentication State</h3><p>Instead of manually checking whether a user is logged in after every screen change, let Firebase handle it.</p><p>Using onAuthStateChanged() ensures your UI automatically responds whenever the authentication state changes.</p><p>This approach is cleaner, more reliable, and keeps your navigation logic simple.</p><h3>Don’t Hardcode Sensitive Information</h3><p>Although the Web Client ID isn’t a secret, avoid scattering it across multiple files.</p><p>Keeping configuration values in a central location makes them easier to update and reduces the chance of mistakes.</p><h3>Test on a Physical Device</h3><p>While Android emulators are useful during development, it’s always a good idea to test Google Sign-In on a real device before releasing your application.</p><p>Some authentication issues only appear on physical devices, particularly those related to Google accounts and Play Services.</p><h3>Keep Your Dependencies Updated</h3><p>Google Sign-In and Firebase Authentication continue to evolve.</p><p>Using the latest stable versions ensures you benefit from bug fixes, security improvements, and compatibility updates.</p><p>Always review the release notes before upgrading major versions.</p><h3>Common Mistakes Developers Make</h3><p>Here are some of the mistakes I’ve seen most often while implementing Google Sign-In:</p><p>❌ Using the Android Client ID instead of the Web Client ID.</p><p>❌ Forgetting to add SHA-256 fingerprints.</p><p>❌ Downloading google-services.json before adding SHA fingerprints and never updating it.</p><p>❌ Forgetting to enable Google Authentication in Firebase.</p><p>❌ Calling GoogleSignin.configure() on every screen.</p><p>❌ Testing only on an emulator.</p><p>❌ Ignoring authentication errors without logging them.</p><p>Most Google Sign-In issues can be traced back to one of these configuration mistakes.</p><h3>Final Authentication Flow</h3><p>By now, your authentication flow should look like this:</p><pre>User taps Google Sign-In<br>          │<br>          ▼<br>Google Authentication<br>          │<br>          ▼<br>Receive ID Token<br>          │<br>          ▼<br>Create Firebase Credential<br>          │<br>          ▼<br>Firebase verifies ID Token<br>          │<br>          ▼<br>Authenticated Firebase User<br>          │<br>          ▼<br>Access User Profile</pre><p>Understanding this flow makes it much easier to debug authentication issues because you know exactly where the process might be failing.</p><h3>Complete Source Code</h3><blockquote><em>The complete working source code for Google Auth integration in React Native is available here:</em></blockquote><blockquote><a href="https://github.com/ermohitpy/SocialLogin">https://github.com/ermohitpy/SocialLogin</a></blockquote><h3>Conclusion</h3><p>Integrating Google Sign-In with Firebase Authentication in React Native is relatively straightforward once the project is configured correctly. Most implementation challenges don’t come from the code itself — they come from configuration details such as SHA fingerprints, OAuth Client IDs, and Firebase project settings.</p><p>By following the steps in this guide, you now have a complete authentication flow that works on both Android and iOS. Users can sign in with their Google account, Firebase securely verifies their identity, and your application gains access to their authenticated profile information.</p><p>If you’re building a production application, remember to go beyond simply making authentication work. Handle errors gracefully, keep your dependencies updated, test on physical devices, and use Firebase’s authentication state listeners to keep your UI in sync.</p><p>I hope this guide helped simplify the process and saved you some debugging time. If you found it useful, feel free to check out the other articles in my React Native Firebase series, where I cover Firebase Setup, Push Notifications, Crashlytics, Analytics, Remote Config, and other authentication methods in detail.</p><p>Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9c621de9749" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Firebase Anonymous Authentication (Guest Login) in React Native Production-Ready Guide…]]></title>
            <link>https://medium.com/@ermohit2k18/implement-firebase-anonymous-authentication-guest-login-in-react-native-production-ready-guide-04e1de70cde9?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/04e1de70cde9</guid>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Tue, 09 Jun 2026 11:54:05 GMT</pubDate>
            <atom:updated>2026-06-09T11:54:05.065Z</atom:updated>
            <content:encoded><![CDATA[<h3>Implement Firebase Anonymous Authentication (Guest Login) in React Native Production-Ready Guide 2026</h3><p>In the previous articles of this Firebase Authentication series, we implemented:</p><ul><li><a href="https://medium.com/@ermohit2k18/implement-firebase-email-password-authentication-in-react-native-production-ready-setup-7e15812fe633">Firebase Email and Password Authentication in React Native</a></li><li><a href="https://medium.com/@ermohit2k18/implement-firebase-phone-authentication-in-react-native-otp-login-production-ready-guide-f3da6d996812">Firebase Phone Authentication in React Native</a></li></ul><p>Both authentication methods require users to provide and verify an identity before entering the app.</p><p>But what if users simply want to try your app before creating an account?</p><p>This is where Firebase Anonymous Authentication becomes very useful.</p><p>Anonymous Authentication allows users to start using your application immediately without entering an email, password, or phone number. Behind the scenes, Firebase still creates a secure user identity with a unique UID that your app can use for temporary user-specific data.</p><p>In this article, we will implement Firebase Anonymous Authentication in React Native and understand how to use it safely in production applications.</p><h3>Why Use Anonymous Authentication?</h3><p>Many successful apps do not force users to register on the first launch.</p><p>Instead, they allow users to:</p><ul><li>Explore the application</li><li>Save temporary data</li><li>Try features before signing up</li><li>Complete onboarding</li><li>Add items to a cart</li><li>Create drafts or notes</li></ul><p>After users understand the value of the app, they can be asked to create a permanent account.</p><p>This reduces onboarding friction and improves user conversion.</p><p>Common use cases include:</p><ul><li>E-commerce guest checkout</li><li>Food delivery apps</li><li>Trial experiences</li><li>Games</li><li>Note-taking apps</li><li>Productivity tools</li></ul><h3>How Firebase Anonymous Authentication Works</h3><p>The flow is simple:</p><pre>User opens app<br>        |<br>        v<br>Continue as Guest<br>        |<br>        v<br>Firebase creates anonymous user<br>        |<br>        v<br>Unique UID is generated<br>        |<br>        v<br>User starts using the app</pre><p>Even though the user does not provide login credentials, Firebase still creates a user record and gives it a unique UID.</p><p>This UID can be used to store temporary user data in Firestore or your backend.</p><h3>Enable Anonymous Authentication</h3><p>Before writing code, enable Anonymous Authentication inside Firebase Console.<br>Open: Firebase Console -&gt; Authentication -&gt; Sign-in method -&gt; Anonymous</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9uyCJlHSAZ-B241zH0LV9A.png" /><figcaption>firebase console</figcaption></figure><p>Enable the provider and save the configuration.<br>Firebase is now ready to create anonymous users.</p><h3>Import Firebase Authentication</h3><p>Import the required methods from React Native Firebase:</p><pre>import {   getAuth,   signInAnonymously, } from &#39;@react-native-firebase/auth&#39;;</pre><p>Create the auth instance:</p><pre>const authInstance = getAuth();</pre><h3>Anonymous Login Implementation</h3><p>Now create a simple guest login function:</p><pre>export const logInAnonymously = async () =&gt; {<br>    try {<br>        await signInAnonymously(authInstance);<br>      } catch (e:any) {<br>        console.log(&#39;====&gt; Error in logInAnonymously:&#39;, e);<br>        Alert.alert(e.message || &#39;Failed to login anonymously. Please try again.&#39;);<br>      }<br>};</pre><p>When this function runs successfully, Firebase automatically creates an anonymous user and signs that user into the app.</p><p>No email, password, or OTP is required.</p><h3>Understanding the Response</h3><p>The response contains a Firebase user object.</p><p>Example:</p><pre>{   user: {     uid: &#39;abc123xyz&#39;,     isAnonymous: true,     email: null,     phoneNumber: null   } }</pre><p>The most important property is:</p><p>response.user.uid</p><p>This UID uniquely identifies the guest user and can be used to:</p><ul><li>Save drafts</li><li>Store preferences</li><li>Track onboarding progress</li><li>Save cart items</li><li>Maintain temporary sessions</li></ul><h3>Detect Anonymous Users</h3><p>Firebase exposes a helpful property called:</p><p>user.isAnonymous</p><p>Example:</p><pre>const user = authInstance.currentUser;<br>if (user?.isAnonymous) {   <br>  console.log(&#39;Guest User&#39;); <br>} else {   <br>  console.log(&#39;Registered User&#39;); <br>}</pre><p>This allows your app to show different UI for guest users and registered users.</p><p>For example:</p><ul><li>Show “Continue as Guest” before login</li><li>Show “Create Account” for anonymous users</li><li>Hide sensitive features until the user upgrades</li><li>Keep checkout or profile completion behind permanent authentication</li></ul><h3>Track Authentication State</h3><p>Production applications should always track authentication state centrally.</p><pre>import {   getAuth,   onAuthStateChanged, } from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br><br>useEffect(() =&gt; {   <br>  const unsubscribe = onAuthStateChanged(authInstance,user =&gt; {       <br>    if (user) {<br>      console.log(&#39;Logged In User:&#39;, user.uid);         <br>      console.log(&#39;Anonymous:&#39;, user.isAnonymous);       <br>    } else {         <br>      console.log(&#39;User Logged Out&#39;);       <br>    }     <br>   });    <br>  return unsubscribe; <br>}, []);</pre><p>This listener helps control navigation between:</p><ul><li>Guest screens</li><li>Login screens</li><li>Protected screens</li><li>Home dashboard</li></ul><p>without manually checking login status everywhere.</p><p>You can also directly access the currently logged-in user whenever needed:</p><pre>export const getCurrentUser = () =&gt; {<br>    return authInstance.currentUser;<br>}</pre><h3>Example Logged-In Screen</h3><p>Here is a simple example that displays a different title for guest and registered users:</p><pre>import { StyleSheet, Text, TouchableOpacity, View } from &#39;react-native&#39;<br>import React from &#39;react&#39;<br>import { getCurrentUser, logOut } from &#39;../../../services/authServices&#39;<br>import { commonStyles } from &#39;../../../CommonStyles&#39;;<br><br>export default function LoggedIn() {<br>    const user = getCurrentUser();<br>    const isAnonymous = user?.isAnonymous || false;<br>    const displayName = user?.email ?? (isAnonymous ? &#39;Guest User&#39; : &#39;User&#39;);<br><br>    return (<br>        &lt;View style={styles.container}&gt;<br>            &lt;Text style={commonStyles.titleTxt}&gt;{`Welcome, ${displayName}!`}&lt;/Text&gt;<br>            &lt;Text style={commonStyles.labelTxt}&gt;{`You are successfully logged in ${isAnonymous ?&#39;anonymously&#39;:&#39;&#39;}!`}&lt;/Text&gt;<br>            &lt;TouchableOpacity style={styles.btn} onPress={logOut}&gt;<br>                &lt;Text style={[commonStyles.labelTxt, { color: &#39;white&#39; }]}&gt;{&#39;LogOut&#39;}&lt;/Text&gt;<br>            &lt;/TouchableOpacity&gt;<br>        &lt;/View&gt;<br>    )<br>}<br><br>const styles = StyleSheet.create({<br>    container: {<br>        flex: 1,<br>        alignItems: &#39;center&#39;,<br>        justifyContent: &#39;center&#39;,<br>    },<br>    btn: { marginTop: 20, backgroundColor: &#39;#eb4034&#39;, padding: 10, borderRadius: 5, paddingHorizontal: 20 }<br>})</pre><h3>Should User Data Be Stored in Firebase Auth?</h3><p>The answer is no.</p><p>Firebase Authentication should only be responsible for identity management.</p><p>Additional user information should be stored in Firestore or your own backend.</p><p>Examples include:</p><ul><li>Username</li><li>Phone number</li><li>Profile image</li><li>Address</li><li>Subscription status</li><li>User preferences</li><li>Cart items</li><li>Drafts</li></ul><p>Recommended architecture:</p><p>Firebase Auth -&gt; identity Firestore -&gt; profile data</p><p>This keeps authentication scalable, secure, and easier to maintain.</p><p>We will implement this profile management flow later in the series after covering the authentication methods.</p><h3>Upgrading Anonymous Users</h3><p>One of the biggest advantages of Anonymous Authentication is account upgrading.</p><p>Suppose a user has already:</p><ul><li>Added products to cart</li><li>Saved notes</li><li>Completed onboarding</li><li>Created temporary preferences</li></ul><p>Later, the user decides to create an account.</p><p>Firebase allows you to link the anonymous account with a permanent sign-in method such as:</p><ul><li>Email and password authentication</li><li>Phone authentication</li><li>Google Sign-In</li><li>Apple Sign-In</li></ul><p>This means the user can become a permanent user without losing existing data.</p><pre>Anonymous user<br>        |<br>        v<br>Link with email, phone, Google, or Apple<br>        |<br>        v<br>Permanent account<br>        |<br>        v<br>Same UID can continue using existing app data</pre><p>For example, if you are upgrading a guest user with email and password, the concept is:</p><pre>export const upgradeAnonymousUser = async (email: string, password: string) =&gt; {<br>    try {<br>        const credential = EmailAuthProvider.credential(email, password);<br>        const user = authInstance.currentUser;<br>        if (user) {<br>            await linkWithCredential(user,credential);<br>            Alert.alert(&#39;Success&#39;, &#39;Anonymous account upgraded successfully!&#39;, [{ text: &#39;OK&#39; }]);<br>        } else {<br>            Alert.alert(&#39;Error&#39;, &#39;No anonymous user found to upgrade.&#39;);<br>        }<br>    } catch (error:any) {<br>        console.log(&#39;====&gt; Error in upgradeAnonymousUser:&#39;, error);<br>        Alert.alert(error.message || &#39;Failed to upgrade account. Please try again.&#39;);<br>    }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*SLiqTp-2yo7QruIQe9hKyw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*Z2Qkla-v8LFC-5bPoamsvg.png" /><figcaption>Upgrade anonymous account with email and password</figcaption></figure><p>This is where Anonymous Authentication becomes powerful in production apps.</p><p>You can let users try the app first, then upgrade them later without deleting their temporary data.</p><p>If you want to understand Email and Password Authentication first, you can read my previous article here:</p><p><a href="https://medium.com/@ermohit2k18/implement-firebase-email-password-authentication-in-react-native-production-ready-setup-7e15812fe633">Implement Firebase Email and Password Authentication in React Native</a></p><p>And if you want to implement OTP-based login, check this article:</p><p><a href="https://medium.com/@ermohit2k18/implement-firebase-phone-authentication-in-react-native-otp-login-production-ready-guide-f3da6d996812">Implement Firebase Phone Authentication in React Native</a></p><h3>Anonymous Authentication vs Email Authentication</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G9QEYTgHcI1XtazCt7aEYg.png" /></figure><h3>Production Considerations</h3><p>Anonymous Authentication is excellent for reducing onboarding friction, but it should not be used as the final identity for:</p><ul><li>Paid subscriptions</li><li>Sensitive personal data</li><li>Banking or finance flows</li><li>Critical business workflows</li><li>Long-term user profiles</li></ul><p>Anonymous users should be treated as temporary users until they are linked with a permanent authentication provider.</p><p>Also remember:</p><ul><li>A user may lose access to an anonymous account after uninstalling the app or clearing app data.</li><li>You should encourage account creation before important actions.</li><li>You should store app data against the Firebase UID so it can survive account upgrades.</li><li>You should handle duplicate credentials while linking accounts.</li><li>You should keep guest permissions limited using Firestore Security Rules.</li></ul><h3>Common Issues Developers Face</h3><ul><li>Anonymous login fails<br>Make sure Anonymous Authentication is enabled inside:<br>Firebase Console -&gt; Authentication -&gt; Sign-in method</li><li>User email is null<br>This is expected for anonymous users.<br>Anonymous users do not have an email, phone number, or provider profile until they are linked with another authentication method.</li></ul><h3>Guest data disappears after logout</h3><p>If the user signs out before linking the account, they may not be able to recover that anonymous account later.</p><p>For important data, ask the user to create an account before logout or before completing a critical action.</p><h3>Linking fails because credential already exists</h3><p>This can happen when the email, phone number, or social account is already connected to another Firebase user.</p><p>Handle this case properly and guide the user to sign in with the existing account.</p><h3>Production Workflow Example</h3><p>A production-ready guest login flow usually looks like this:</p><pre>User opens app<br>        |<br>        v<br>Continue as Guest<br>        |<br>        v<br>Firebase creates anonymous UID<br>        |<br>        v<br>Store temporary data in Firestore using UID<br>        |<br>        v<br>User explores app<br>        |<br>        v<br>User decides to create account<br>        |<br>        v<br>Link anonymous account with permanent provider<br>        |<br>        v<br>User keeps existing data</pre><p>This flow is very useful for apps where users should experience value before registration.</p><h3>Complete Source Code</h3><blockquote>The complete working source code for Firebase Anonymous Authentication integration in React Native is available here:</blockquote><blockquote><a href="https://github.com/ermohitpy/firebase/tree/anonymous_auth">https://github.com/ermohitpy/firebase/tree/anonymous-auth</a></blockquote><h3>Conclusion</h3><p>Firebase Anonymous Authentication is one of the simplest ways to improve onboarding in React Native apps.</p><p>With just a few lines of code, Firebase creates a secure temporary identity and gives the user a unique UID that can be used throughout your application.</p><p>In this article, we learned:</p><ul><li>What Anonymous Authentication is</li><li>How to enable it in Firebase</li><li>How to sign in anonymously</li><li>How to detect guest users</li><li>How to track authentication state</li><li>How to upgrade anonymous users later</li><li>What to keep in mind before using guest login in production</li></ul><p>Anonymous Authentication works best when it is used as the first step of a user journey, not the final identity.</p><p>In the next article of this Firebase Authentication series, we will explore Google Sign-In Authentication and learn how to authenticate users using their Google accounts in React Native.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04e1de70cde9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Implement Firebase Phone Authentication in React Native (OTP Login — Production-Ready Guide…]]></title>
            <link>https://medium.com/@ermohit2k18/implement-firebase-phone-authentication-in-react-native-otp-login-production-ready-guide-f3da6d996812?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3da6d996812</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[firebase-phone-auth]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Thu, 07 May 2026 09:10:40 GMT</pubDate>
            <atom:updated>2026-05-07T09:10:40.035Z</atom:updated>
            <content:encoded><![CDATA[<h3>📱 Implement Firebase Phone Authentication in React Native (OTP Login — Production-Ready Guide 2026)</h3><p>Firebase Phone Authentication is one of the most widely used authentication methods in modern mobile applications.</p><p>It allows users to log in quickly using their mobile number and OTP verification, removing the need to remember passwords and significantly improving onboarding experience.</p><p>This article is part of my ongoing React Native Firebase integration series, where I share production-ready implementations for Firebase services like:</p><p>• Firebase Push Notifications <br>• Firebase Analytics <br>• Firebase Remote Config <br>• Firebase Crashlytics <br>• Firebase Email Authentication</p><p>and now Firebase Phone Number Authentication.</p><p>In this guide, we’ll implement Phone Authentication using Firebase Authentication in a React Native project step-by-step.</p><h3>📦 Prerequisites</h3><p>Before starting:</p><p>React Native CLI project created<br>Firebase project configured<br>@react-native-firebase/app installed<br>@react-native-firebase/auth installed</p><p>Add the following dependency inside your app-level build.gradle file:</p><pre>// for the Firebase Authentication library<br>implementation(&quot;com.google.firebase:firebase-auth&quot;)</pre><p>If you followed the previous Email Authentication article in this series, your setup is already ready.</p><h3>⚙️ Step 1: Enable Phone Authentication in Firebase Console</h3><p>Open: Firebase Console → Authentication → Sign-in Method</p><p>Enable: Phone Authentication</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxrW4Bxceo8-dAiFWZQVNg.png" /><figcaption>enable phone auth</figcaption></figure><blockquote>Firebase Phone Authentication requires billing to send real OTP SMS messages.<br>For development and testing purposes, Firebase provides test phone numbers and OTPs that work without enable billing.</blockquote><p>You can add test phone numbers and predefined OTPs inside Firebase Console. During development, entering those numbers and OTPs will authenticate the user successfully without sending real SMS messages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_QqF5KjX-mI4-0yTYJ1ug.png" /><figcaption>Add testing phone number</figcaption></figure><p>For Phone authentication requires additional configuration steps:<br><strong>For iOS :</strong><br>Firebase uses two mechanisms to verify phone authentication requests:</p><p>1. Silent APNs Notifications <br>2. reCAPTCHA Verification (fallback)</p><p>When a user signs in with a phone number for the first time, Firebase attempts to silently verify the request using APNs notifications.</p><p>If silent verification is unavailable (for example on simulators or when background refresh is disabled), Firebase automatically falls back to reCAPTCHA verification.</p><p>To test Phone Authentication properly on iOS, you’ll need:<br>• An Apple Developer Account <br>• A real iOS device <br>• APNs configured correctly</p><p><strong>For Android :</strong><br>1. Open Google Cloud Console and select your Firebase project <br>2. Go to APIs &amp; Services <br>3. Click Enable APIs &amp; Services <br>4. Search for Play Integrity API <br>5. Enable the API <br>6. Create credentials by following the setup instructions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pom_KdIOQ_N0C2fSI_B-nw.png" /><figcaption>1. Google Cloud Console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZXVgiE9MFiOVc7l8MxUuw.png" /><figcaption>2. Enabled APIs and services</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMe_cau41y1vGSg-XWJN-g.png" /><figcaption>3. Search for api</figcaption></figure><blockquote>Add both SHA-1 and SHA-256 fingerprints inside:<br>Firebase Console → Project Settings → Android App → Add Fingerprint<br>To get SHA fingerprints use the following command:</blockquote><pre>cd android &amp;&amp; ./gradlew signingReport</pre><p>Save changes.</p><p><strong>After all these steps re-download the google-services.json file and replace it with the existing file in the app</strong><br>Your backend configuration for OTP authentication is now ready.</p><h3>📲 Step 2: Request OTP on Phone Number</h3><p>Firebase sends an OTP automatically after verifying the phone number request.</p><p>Example:</p><pre>//authServices.ts<br>import {<br>  getAuth,<br>  signInWithPhoneNumber<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>export const signInWithPhoneNo = async (phoneNumber: string) =&gt; {<br>    try {<br>        const confirmationResult = await signInWithPhoneNumber(authInstance, phoneNumber);<br>        return confirmationResult;<br>    } catch (error) {<br>        console.log(&#39;Error in signIn:&#39;, error);<br>        Alert.alert(error.message || &#39;Failed to send OTP. Please try again.&#39;);<br>    }<br>}</pre><p>Example phone format:</p><pre>+91{mobile_no}</pre><p>Always include country code.<br>And then use the function in our component:</p><pre>import { ActivityIndicator, Alert, KeyboardAvoidingView, StyleSheet, Text, TextInput, TouchableOpacity } from &#39;react-native&#39;<br>import React, { useState } from &#39;react&#39;<br>import { signInWithPhoneNo } from &#39;../../../services/authServices&#39;;<br><br>export default function LoginWithPhone() {<br>    const [loading, setLoading] = useState&lt;boolean&gt;(false);<br>    const [phoneNumber, setPhoneNumber] = useState&lt;string&gt;(&#39;&#39;);<br>    const [confirmationResult, setConfirmationResult] = useState&lt;any&gt;(null);<br><br>    const handleSendOTP = async () =&gt; {<br>        console.log(&#39;Phone number entered:&#39;, phoneNumber);<br>        if (!phoneNumber) {<br>            Alert.alert(&#39;Please enter a valid phone number&#39;);<br>            return;<br>        }<br>        setLoading(true);<br>        const res = await signInWithPhoneNo(phoneNumber);<br>        console.log(&#39;OTP sent response:&#39;, res);<br>        if (res) {<br>            setConfirmationResult(res);<br>            setPhoneNumber(&#39;&#39;);<br>        }<br>        setLoading(false);<br>    }<br><br>    return (<br>        &lt;KeyboardAvoidingView style={styles.container} behavior=&#39;padding&#39;&gt;<br>            &lt;Text style={styles.titleTxt}&gt;{&#39;Enter Your Mobile No. With Country Code&#39;}&lt;/Text&gt;<br>            &lt;TextInput<br>                style={styles.inputBox}<br>                placeholder={&#39;Mobile No. Eg. +919999999999&#39;}<br>                keyboardType=&#39;phone-pad&#39;<br>                onChangeText={setPhoneNumber}<br>                value={phoneNumber}<br>                editable={!loading}<br>            /&gt;<br>            &lt;TouchableOpacity disabled={loading} onPress={handleSendOTP}&gt;<br>                {loading ? &lt;ActivityIndicator /&gt; : &lt;Text style={styles.btn}&gt;{&#39;Send OTP&#39;}&lt;/Text&gt;}<br>            &lt;/TouchableOpacity&gt;<br>        &lt;/KeyboardAvoidingView&gt;<br>    )<br>}<br><br>const styles = StyleSheet.create({<br>    container: {<br>        flex: 1,<br>        justifyContent: &#39;center&#39;,<br>        alignItems: &#39;center&#39;,<br>    },<br>    titleTxt: { color: &#39;black&#39;, fontSize: 18 },<br>    inputBox: { borderWidth: 1, borderColor: &#39;gray&#39;, width: &#39;80%&#39;, padding: 10, marginVertical: 20, color: &#39;black&#39; },<br>    btn: { color: &#39;white&#39;, backgroundColor: &#39;blue&#39;, padding: 10, borderRadius: 5 }<br><br><br>})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*FPURs6zxHNbMYM2bwfAjZw.png" /><figcaption>Enter mobile no screen</figcaption></figure><h3>🔐 Step 3: Verify OTP Entered by User</h3><p>Once OTP is received, verify it using the confirmation object returned earlier.<br>Example:</p><pre>//authsServices.ts<br>export const confirmOTP = async (confirmationResult: any, otp: string) =&gt; {<br>    try {<br>        const response = await confirmationResult.confirm(otp);<br>        return response;<br>    } catch (error) {<br>        Alert.alert(error.message || &#39;Failed to confirm OTP. Please try again.&#39;);<br>    }<br>}</pre><pre>import { ActivityIndicator, Alert, KeyboardAvoidingView, StyleSheet, Text, TextInput, TouchableOpacity } from &#39;react-native&#39;<br>import React, { useState } from &#39;react&#39;<br>import { confirmOTP, signInWithPhoneNo } from &#39;../../../services/authServices&#39;;<br><br>let confirmationResult: any = null;<br>export default function LoginWithPhone() {<br>    const [loading, setLoading] = useState&lt;boolean&gt;(false);<br>    const [phoneNumber, setPhoneNumber] = useState&lt;string&gt;(&#39;&#39;);<br>    const [showOtpInput, setShowOtpInput] = useState&lt;boolean&gt;(false);<br><br>    const handleSendOTP = async () =&gt; {<br>        console.log(&#39;Phone number entered:&#39;, phoneNumber);<br>        if (!phoneNumber) {<br>            Alert.alert(&#39;Please enter a valid phone number&#39;);<br>            return;<br>        }<br>        setLoading(true);<br>        const res = await signInWithPhoneNo(phoneNumber);<br>        console.log(&#39;OTP sent response:&#39;, res);<br>        if (res) {<br>            setShowOtpInput(true);<br>            confirmationResult = res;<br>            setPhoneNumber(&#39;&#39;);<br>        }<br>        setLoading(false);<br>    }<br><br>    const handleConfirmOTP = async () =&gt; {<br>        if (phoneNumber.length !== 6) {<br>            Alert.alert(&#39;Please enter a valid 6 digit OTP&#39;);<br>            return;<br>        }<br>        setLoading(true);<br>        const res = await confirmOTP(confirmationResult, phoneNumber);<br>        console.log(&#39;OTP confirmation response:&#39;, res);<br>        setLoading(false);<br>    }<br><br>    return (<br>        &lt;KeyboardAvoidingView style={styles.container} behavior=&#39;padding&#39;&gt;<br>            &lt;Text style={styles.titleTxt}&gt;{showOtpInput ? &#39;Enter OTP Here&#39; : &#39;Enter Your Mobile No. With Country Code&#39;}&lt;/Text&gt;<br>            &lt;TextInput<br>                style={styles.inputBox}<br>                placeholder={showOtpInput ? &#39;Enter 6 digit otp&#39; : &#39;Mobile No. Eg. +919999999999&#39;}<br>                keyboardType=&#39;phone-pad&#39;<br>                onChangeText={setPhoneNumber}<br>                value={phoneNumber}<br>                maxLength={showOtpInput ? 6 : 15}<br>                editable={!loading}<br>            /&gt;<br>            &lt;TouchableOpacity disabled={loading} onPress={showOtpInput ? handleConfirmOTP : handleSendOTP}&gt;<br>                {loading ? &lt;ActivityIndicator /&gt; : &lt;Text style={styles.btn}&gt;{showOtpInput ? &#39;Verify OTP&#39; : &#39;Send OTP&#39;}&lt;/Text&gt;}<br>            &lt;/TouchableOpacity&gt;<br>        &lt;/KeyboardAvoidingView&gt;<br>    )<br>}<br><br>const styles = StyleSheet.create({<br>    container: {<br>        flex: 1,<br>        justifyContent: &#39;center&#39;,<br>        alignItems: &#39;center&#39;,<br>    },<br>    titleTxt: { color: &#39;black&#39;, fontSize: 18 },<br>    inputBox: { borderWidth: 1, borderColor: &#39;gray&#39;, width: &#39;80%&#39;, padding: 10, marginVertical: 20, color: &#39;black&#39; },<br>    btn: { color: &#39;white&#39;, backgroundColor: &#39;blue&#39;, padding: 10, borderRadius: 5 }<br>})</pre><p>Since we are using Firebase test phone numbers during development, we can verify authentication using the predefined OTP configured in Firebase Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*cSTjSAEpTFGy1XyBz9IjcQ.png" /><figcaption>otp screen</figcaption></figure><p>After successful verification:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*TLJOBYpwgwXm23bRyGnjeQ.png" /><figcaption>user logged in using phone</figcaption></figure><p>Firebase automatically logs the user into the application.<br>No additional login call is required.</p><h3>📡 Step 4: Detect Authentication State Automatically</h3><p>Just like Email Authentication, Phone Authentication also updates login state automatically.<br>Example:</p><pre>import {<br>  getAuth,<br>  onAuthStateChanged<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>useEffect(() =&gt; {<br>  const unsubscribe =<br>    onAuthStateChanged(authInstance, user =&gt; {<br>      if (user) {<br>        console.log(<br>          &#39;User logged in:&#39;,<br>          user.phoneNumber<br>        );<br>      } else {<br>        console.log(&#39;User logged out&#39;);<br>      }<br>    });<br>  return unsubscribe;<br>}, []);</pre><p>This listener helps control navigation between:</p><ul><li>Login Screen</li><li>OTP Verification Screen</li><li>Home Dashboard</li></ul><p>without manually checking login status everywhere.</p><h3>👤 Access Current Logged-In Phone User Anytime</h3><p>Firebase also allows direct access to the authenticated user.<br>Example:</p><pre>export const getCurrentUser = () =&gt; {<br>  return authInstance.currentUser;<br>};</pre><p>From this object you can access:</p><ul><li>uid</li><li>Phone number</li><li>Display name</li><li>Profile photo</li></ul><p>This becomes useful when attaching user identity to:</p><ul><li>Crashlytics logs</li><li>Firestore profile documents</li><li>Analytics tracking</li></ul><p>inside production applications.</p><h3>⚠️ Common Issues Developers Face</h3><blockquote>Real OTP SMS delivery requires Firebase billing to be enabled.<br>For development and testing, Firebase test phone numbers can be used without billing.</blockquote><ul><li>OTP not received<br><strong>Solution:</strong> Check correct country code format</li><li>Verification fails instantly<br><strong>Solution:</strong> Ensure device has network connectivity</li><li>Too many requests error<br><strong>Solution:</strong> Firebase limits repeated OTP attempts temporarily for security</li><li>Testing OTP fails on emulator<br><strong>Solution:</strong> Use real device or configure test numbers inside Firebase Console</li></ul><h3>📊 Production Use Cases of Phone Authentication</h3><p>Real applications use Phone Authentication for:</p><ul><li>Faster onboarding</li><li>Password-less login experience</li><li>Improved login success rate</li><li>Identity verification</li><li>Two-factor authentication workflows</li></ul><p>Example: Ride booking apps, Fintech apps, Delivery platforms, Healthcare apps , etc.<br>depend heavily on OTP authentication.</p><h3>🧱 Best Practices for Production Apps</h3><p>Always store additional user profile data inside Firestore after authentication:</p><ul><li>username</li><li>email</li><li>profile image</li><li>subscription plan</li><li>app preferences</li></ul><p>Example architecture:</p><pre>Firebase Auth → identity<br>Firestore → profile data</pre><p>We’ll implement this profile storage flow step-by-step in upcoming articles of this authentication series.</p><h3>📡 When Authentication State Updates</h3><p>Firebase automatically updates authentication state:</p><ul><li>After OTP verification</li><li>After logout</li><li>After token refresh</li><li>After app restart</li></ul><p>Production apps rely heavily on this automatic session persistence.</p><h3>🚀 Production Workflow Example</h3><p>Typical Phone Authentication flow:</p><pre>User enters phone number<br>↓<br>Firebase sends OTP<br>↓<br>User verifies OTP<br>↓<br>Firebase creates UID<br>↓<br>Store profile data in Firestore<br>↓<br>Attach UID to Crashlytics session<br>↓<br>Enable protected navigation</pre><p>This workflow is used in most production React Native apps today.</p><h3>🎉 Final Thoughts</h3><p>Firebase Phone Authentication provides a fast, secure, and user-friendly authentication experience for mobile applications.</p><p>It reduces onboarding friction, improves login conversion rates, and integrates seamlessly with other Firebase services like:</p><p>• Firebase Analytics <br>• Firebase Crashlytics <br>• Firestore Database <br>• Firebase Remote Config</p><p>making it a powerful authentication solution for production-ready React Native applications.</p><blockquote>The complete working source code for <strong>Firebase Phone Authentication integration in React Native</strong> is available here:<br><a href="https://github.com/ermohitpy/firebase/tree/phone_auth">https://github.com/ermohitpy/firebase/tree/phone_auth</a></blockquote><p>In the next article of this Firebase integration series, we’ll implement:</p><p><strong>🔐 Multi-Factor Authentication (MFA) using Firebase Authentication</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3da6d996812" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Implement Firebase Email & Password Authentication in React Native (Production-Ready Setup —…]]></title>
            <link>https://medium.com/@ermohit2k18/implement-firebase-email-password-authentication-in-react-native-production-ready-setup-7e15812fe633?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e15812fe633</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 06:43:50 GMT</pubDate>
            <atom:updated>2026-04-29T06:43:50.384Z</atom:updated>
            <content:encoded><![CDATA[<h3>🔐 Implement Firebase Email &amp; Password Authentication in React Native (Production-Ready Setup — Step-by-Step Guide 2026)</h3><p>Firebase Authentication is one of the most essential services when building production-ready mobile applications.</p><p>It allows developers to securely authenticate users without writing complex backend authentication logic.</p><p>This article is part of my <strong>React Native Firebase integration series</strong>, where I share production-ready implementations for Firebase services like:</p><ul><li>Firebase Push Notifications</li><li>Firebase Analytics</li><li>Firebase Remote Config</li><li>Firebase Crashlytics</li></ul><p>and now <strong>Firebase Authentication<br></strong>In this guide, we’ll implement <strong>Email &amp; Password Authentication in React Native using React Native Firebase</strong> with a clean production-ready setup.</p><p>In upcoming articles of this series, we’ll continue authentication setup using <strong>Phone Number OTP Authentication</strong> 📱</p><h3>📦 Prerequisites</h3><p>Before starting:</p><p>React Native CLI project created<br>Firebase project configured<br>@react-native-firebase/app installed</p><p>If you followed my previous Firebase setup guide or Crashlytics article, you’re ready to continue.</p><h3>⚙️ Step 1: Install Firebase Authentication</h3><p>Install dependency:</p><pre>npm install @react-native-firebase/auth</pre><p>For iOS:</p><pre>cd ios &amp;&amp; pod install</pre><p>Authentication initializes automatically after installation.</p><h3>🔥 Step 2: Enable Email &amp; Password Authentication in Firebase Console</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tMXymGMyKE3ZmCRM1g9y6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Ni4C5LsVpafzNGy9pHZWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xg9VY1fcweLJp-Nbakd_QA.png" /><figcaption>Firebase Console</figcaption></figure><p>Open:<br>Firebase Console → Authentication → Sign-in Method</p><p>Enable: Email / Password</p><p>Save changes.<br>Your Firebase backend authentication setup is now ready.</p><h3>👤 Step 3: Create New User (Signup Implementation)</h3><p>Example:</p><pre>import {<br>  getAuth,<br>  createUserWithEmailAndPassword,<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>const signUp = async (email, password) =&gt; {<br>  try {<br>    const response =<br>      await createUserWithEmailAndPassword(<br>        authInstance,<br>        email,<br>        password<br>      );<br>    console.log(&#39;User created:&#39;, response.user.uid);<br>  } catch (error) {<br>    console.log(&#39;Signup error:&#39;, error.message);<br>  }<br>};</pre><blockquote>When using the createUserWithEmailAndPassword method, Firebase automatically creates a new user account with the provided email and password. Along with account creation, Firebase also signs the user into the application immediately after successful registration.</blockquote><p>Firebase automatically generates a <strong>unique UID</strong> for each user.<br>This UID becomes the primary identifier for storing user-related data inside Firestore later.<br>Production apps rely heavily on this UID mapping.</p><h3>🔐 Step 4: Login Existing Users</h3><p>Example:</p><pre>import {<br>  getAuth,<br>  signInWithEmailAndPassword,<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>const login = async (email, password) =&gt; {<br>  try {<br>    const response =<br>      await signInWithEmailAndPassword(<br>        authInstance,<br>        email,<br>        password<br>      );<br>    console.log(&#39;User logged in:&#39;, response.user.uid);<br>  } catch (error) {<br>    console.log(&#39;Login error:&#39;, error.message);<br>  }<br>};</pre><p>Once login succeeds:</p><p>Firebase automatically maintains user session state across app restarts.<br>No manual token handling required.</p><h3>📡 Step 5: Detect Authentication State Automatically</h3><p>Production apps should always track login state centrally.</p><p>Example:</p><pre>import {<br>  getAuth,<br>  onAuthStateChanged<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>useEffect(() =&gt; {<br>  const unsubscribe =<br>    onAuthStateChanged(authInstance, user =&gt; {<br>      if (user) {<br>        console.log(&#39;User logged in:&#39;, user.email);<br>      } else {<br>        console.log(&#39;User logged out&#39;);<br>      }<br>    });<br>  return unsubscribe;<br>}, []);</pre><p>This listener helps control navigation between:</p><ul><li>Login Screen</li><li>Protected Screens</li><li>Home Dashboard</li></ul><p>without manually checking login status everywhere.</p><p><strong>👤 Access Current Logged-In User Anytime</strong></p><p>In addition to using the authentication listener, Firebase also provides a simple way to access the currently logged-in user directly.<br>Example:</p><pre>const getCurrentUser = () =&gt; {<br>  return authInstance.currentUser;<br>};</pre><p>Using this helper function, you can quickly fetch details of the authenticated user such as:</p><ul><li>user UID</li><li>email address</li><li>display name</li><li>profile photo</li></ul><p>This is especially useful when attaching user information to services like <strong>Crashlytics, Analytics, or Firestore profile documents</strong> inside production applications.</p><h3>🚪 Step 6: Logout User</h3><p>Example:</p><pre>import {<br>  getAuth,<br>  signOut<br>} from &#39;@react-native-firebase/auth&#39;;<br><br>const authInstance = getAuth();<br>const logout = async () =&gt; {<br>  try {<br>    await signOut(authInstance);<br>    console.log(&#39;User logged out successfully&#39;);<br>  } catch (error) {<br>    console.log(error.message);<br>  }<br>};</pre><p>Firebase automatically clears session tokens after logout.</p><h3>⚠️ Common Issues Developers Face</h3><ul><li>Signup fails with weak password<br>Solution: Use password length ≥ 6 characters</li><li>User already exists error<br>Solution: Handle duplicate signup attempts properly</li><li>Login fails even with correct credentials<br>Solution: Ensure Email/Password authentication is enabled inside Firebase Console</li><li>User session resets unexpectedly<br>Solution: Use onAuthStateChanged() listener in root component</li></ul><h3>📊 Production Use Cases of Firebase Authentication</h3><p>Real applications use Firebase Authentication for:</p><ul><li>Secure onboarding</li><li>Session persistence</li><li>Multi-device login</li><li>User identity management</li><li>Firestore profile mapping</li><li>Analytics user tracking</li><li>Crashlytics user identification</li></ul><p>Example:</p><p>Attach Firebase UID inside Crashlytics session</p><pre>setUserId(crashlyticsInstance, user.uid);</pre><p>This helps debug production issues faster.</p><h3>🧱 Best Practices for Production Apps</h3><p>Always store additional profile data inside Firestore:</p><ul><li>username</li><li>phone number</li><li>profile image</li><li>address</li><li>subscription status</li></ul><p>Firebase Auth should only handle identity.<br>Firestore should handle user profile data.<br>Example architecture:</p><pre>Firebase Auth → identity<br>Firestore → profile data</pre><p>This keeps authentication scalable and secure.</p><blockquote>We’ll implement this user profile storage flow step-by-step after completing the authentication articles in this series.</blockquote><h3>📡 When Authentication State Updates</h3><p>Firebase updates authentication session automatically:</p><ul><li>After login</li><li>After logout</li><li>After token refresh</li><li>After app restart</li></ul><p>Production apps rely heavily on this automatic session persistence.</p><h3>🚀 Production Workflow Example</h3><p>Typical authentication flow:</p><pre>User Signup<br>↓<br>Firebase creates UID<br>↓<br>Store profile data in Firestore<br>↓<br>Attach UID to Crashlytics session<br>↓<br>Track analytics events<br>↓<br>Enable protected navigation</pre><p>This workflow is used in most production React Native apps today.</p><h3>🎉 Final Thoughts</h3><p>Firebase Email &amp; Password Authentication provides a fast and secure way to onboard users into your mobile application.</p><p>It removes the need for custom authentication backend logic and integrates smoothly with other Firebase services like:</p><ul><li>Firebase Analytics</li><li>Firebase Crashlytics</li><li>Firebase Remote Config</li><li>Firestore Database</li></ul><p>Making it a powerful foundation for production-ready authentication systems.</p><blockquote>The complete working source code for integrating <strong>Firebase Email &amp; Password Authentication</strong> in a React Native application is available here: <a href="https://github.com/ermohitpy/firebase/tree/auth_with_email_pass">https://github.com/ermohitpy/firebase/tree/auth_with_email_pass</a></blockquote><p>In the <strong>next article of this Firebase integration series</strong>, we’ll implement:</p><p>📱 <strong>Firebase Phone Number Authentication using OTP verification</strong></p><p>which enables faster onboarding and improves login conversion rates in mobile apps.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e15812fe633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚙️ Implement Firebase Crashlytics in React Native (Detect Production Crashes Before Users Report…]]></title>
            <link>https://medium.com/@ermohit2k18/%EF%B8%8F-implement-firebase-crashlytics-in-react-native-detect-production-crashes-before-users-report-62216c3fa450?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/62216c3fa450</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[crashlytics]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 10:47:26 GMT</pubDate>
            <atom:updated>2026-04-16T10:47:26.818Z</atom:updated>
            <content:encoded><![CDATA[<h3>⚙️ Implement Firebase Crashlytics in React Native (Detect Production Crashes Before Users Report Them — Step-by-Step Guide 2026)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5kYoppIUknf-gJRSFWKUpQ.png" /></figure><p>Firebase Crashlytics is one of the most important tools you can integrate into a production React Native application.</p><p>It helps detect crashes in real time, understand what caused them, and fix issues before they affect more users.</p><p>This article is part of my <strong>React Native Firebase integration series</strong>, where I share production-ready implementations for Firebase services like push notifications, analytics, remote config, and now <strong>Crashlytics</strong>.</p><p>In production apps, Crashlytics allows developers to monitor stability, identify errors faster, and improve release quality without waiting for user complaints.</p><p>In this guide, we’ll implement Firebase Crashlytics in React Native using <strong>React Native Firebase</strong> with a production-ready setup.</p><h3>📦 Prerequisites</h3><p>Before starting:</p><p>React Native CLI project created<br>Firebase project configured<br>@react-native-firebase/app installed</p><p>If you followed my previous Firebase setup guide or Remote Config article, you’re ready to continue.</p><h3>⚙️ Step 1: Install Firebase Crashlytics</h3><p>Install dependency:</p><pre>npm install @react-native-firebase/crashlytics</pre><p>For iOS:</p><pre>cd ios &amp;&amp; pod install</pre><p>Add these configs in android native side:<br>Open : /android/build.gradle</p><pre>// Add the following line in dependencies<br>classpath &#39;com.google.firebase:firebase-crashlytics-gradle:3.0.6&#39;</pre><p>Now in app level build.gradle<br>Open : /android/app/build.gradle</p><pre>apply plugin: &#39;com.google.firebase.crashlytics&#39; //In the top of the file with other plugins<br><br>// Add this in the dependencies block<br>implementation(&quot;com.google.firebase:firebase-crashlytics&quot;)</pre><h3>(Optional) Enable Crashlytics NDK reporting</h3><p>Crashlytics NDK reporting allows you to capture Native Development Kit crashes, e.g. in React Native this will capture crashes originating from the Yoga layout engine.</p><p>Add the firebaseCrashlytics block line to the android/app/build.gradle file:</p><pre>android {<br>    // ...<br>buildTypes {<br>        release {<br>            /* Add the firebaseCrashlytics extension (by default,<br>            * it&#39;s disabled to improve build speeds) and set<br>            * nativeSymbolUploadEnabled to true along with a pointer to native libs. */<br>            firebaseCrashlytics {<br>                nativeSymbolUploadEnabled true<br>                unstrippedNativeLibsDir &#39;build/intermediates/merged_native_libs/release/out/lib&#39;<br>            }<br>            // ...<br>        }<br>    }<br>}</pre><p>Whenever installing a new Firebase dependency, it’s recommended to rebuild the Android project:</p><pre>cd android &amp;&amp; ./gradlew clean &amp;&amp; cd ..</pre><p>Crashlytics initializes automatically after installation.</p><h3>🔥 Step 2: Enable Crashlytics in Firebase Console</h3><p>Open:</p><p>Firebase Console → Crashlytics</p><p>If Crashlytics isn’t enabled yet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zkbMBNUtMIacV6dVwt-41w.png" /><figcaption>crashlytics dashboard</figcaption></figure><p>Click: Add SDK</p><p>Firebase may take a few minutes to start processing crash data for the first time.<br>Once enabled, your dashboard becomes ready to receive crash reports.</p><h3>💥 Step 3: Trigger Your First Test Crash</h3><p>To confirm setup works correctly, trigger a test crash.<br>Example:</p><pre>import { getCrashlytics, log, setCrashlyticsCollectionEnabled } from &#39;@react-native-firebase/crashlytics&#39;;<br>const crashlyticsInstance = getCrashlytics();<br>setCrashlyticsCollectionEnabled(crashlyticsInstance, true);<br>const CrashlyticsDashboard = () =&gt; {<br>  const triggerCrash = () =&gt; {<br>    // test crash<br>    log(crashlyticsInstance, &#39;First Crash!!&#39;);<br>  }<br><br>  return (<br>    &lt;View style={styles.container}&gt;<br>      &lt;TouchableOpacity style={styles.btn} onPress={triggerCrash}&gt;<br>        &lt;Text style={styles.txt}&gt;{&#39;Trigger Crash&#39;}&lt;/Text&gt;<br>      &lt;/TouchableOpacity&gt;<br>    &lt;/View&gt;<br>  )<br>}</pre><p>Run the application once.</p><p>Then open:<br>Firebase Console → Crashlytics</p><blockquote>By default, Crashlytics does not report crashes during development to keep your production logs clean. However, if you need to test your integration while debugging, you must explicitly enable it.</blockquote><p>Navigate to your project’s root and open firebase.json (create the file if it doesn&#39;t exist) and add the following configuration:</p><pre>{<br>    &quot;react-native&quot;: {<br>        &quot;crashlytics_debug_enabled&quot;: true<br>    }<br>}</pre><p>Within a short time, your crash report appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HNMWrd3F0V5Al7rXmSZdPg.png" /></figure><p>This confirms Crashlytics is successfully integrated.</p><h3>📲 Step 4: Record Non-Fatal Errors (Production Best Practice)</h3><p>Not all issues should crash the app.<br>Sometimes we just want to track unexpected behavior.<br>Example:</p><pre>import crashlytics from &#39;@react-native-firebase/crashlytics&#39;;<br><br>try {<br>  riskyOperation();<br>} catch (error) {<br>  crashlytics().recordError(error);<br>}</pre><p>These appear as <strong>non-fatal issues</strong> inside Crashlytics dashboard.<br>Production apps rely heavily on this workflow.</p><h3>🧩 Step 5: Add Custom Logs Before a Crash Happens</h3><p>Crash stack traces sometimes don’t explain what happened before the crash.<br>We solve this using logs.<br>Example:</p><pre>crashlytics().log(&#39;User tapped checkout button&#39;);</pre><p>Now Crashlytics shows what happened just before failure.This dramatically improves debugging speed.</p><h3>👤 Step 6: Attach User ID to Crash Reports</h3><p>In production debugging, knowing <strong>which user experienced the crash</strong> helps reproduce issues faster.</p><blockquote>Set your unique identifiers as high up in the component tree as possible (e.g., App.tsx mount) or inside your authentication listener. Persisting the User ID early ensures that if a crash occurs later in the session, your logs will already have the necessary context to identify who was affected and why.</blockquote><p>Example:</p><pre>// Example: Setting UID for Crashlytics after Login<br>useEffect(() =&gt; {<br>  if (user) {<br>    setUserId(crashlyticsInstance,user.uid);<br>    log(crashlyticsInstance,&#39;User authenticated and ID bound.&#39;);<br>  }<br>}, [user]);</pre><p>Now crash reports connect directly with affected user sessions.<br>This is especially useful for:</p><ul><li>support teams</li><li>QA validation</li><li>production issue tracking</li></ul><h3>🎯 Step 7: Add Custom Attributes for Better Debugging</h3><p>Crashlytics allows attaching metadata to crash sessions.</p><p>Example:</p><pre>crashlytics().setAttribute(&#39;payment_method&#39;, &#39;UPI&#39;);</pre><p>Or multiple attributes:</p><pre>crashlytics().setAttributes({<br>  screen: &#39;Checkout&#39;,<br>  subscription: &#39;Premium&#39;,<br>  buildType: &#39;Production&#39;,<br>});</pre><p>Now crashes can be filtered inside Firebase dashboard using these attributes.</p><p>Production apps depend heavily on this segmentation capability.</p><h3>📡 Step 8: Track App Flow Before Crashes</h3><p>Example:</p><pre>crashlytics().log(&#39;Checkout screen opened&#39;);<br>crashlytics().log(&#39;Payment API called&#39;);<br>crashlytics().log(&#39;Waiting for response&#39;);</pre><p>If crash occurs after this sequence:</p><p>You immediately know where the issue happened.</p><p>This reduces debugging time significantly.</p><h3>📊 Step 9: Monitor Release Stability Using Crash-Free Metrics</h3><p>Crashlytics automatically tracks:</p><p>Crash-free users %<br>Crash-free sessions %</p><p>These metrics help answer:</p><p>Is this release safe?</p><p>If stability drops after deployment:</p><p>You can quickly rollback or hotfix.</p><p>Production teams monitor this after every release.</p><h3>🚀 Step 10: Log Expected API Failures Without Crashing App</h3><p>Example:</p><pre>crashlytics().recordError(<br>  new Error(&#39;Payment API timeout&#39;)<br>);</pre><p>Users continue using the app normally.</p><p>But developers still get visibility into the issue.</p><p>Useful for tracking:</p><ul><li>network failures</li><li>retry loops</li><li>third-party service downtime</li><li>edge-case bugs</li></ul><h3>📡 When Crash Reports Are Sent to Firebase</h3><p>Crash reports upload automatically:</p><p>after app restart (for fatal crashes)<br>immediately (for non-fatal errors)</p><p>So always relaunch the app once after triggering a test crash.</p><h3>🚀 Production Use Cases of Firebase Crashlytics</h3><p>Real apps use Crashlytics for:</p><ul><li>release stability monitoring</li><li>tracking crashes after new deployments</li><li>detecting OS-specific issues</li><li>debugging device-specific failures</li><li>monitoring payment failures</li><li>tracking API instability</li><li>identifying feature rollout risks</li></ul><p>Example:<br>Crash only happening on Android 14 devices<br>Crashlytics helps detect this instantly.</p><h3>🧱 Best Practices for Production Apps</h3><p>Always attach:</p><ul><li>screen name</li><li>user id</li><li>build version</li><li>feature flag state</li><li>API version</li></ul><p>Example:</p><pre>crashlytics().setAttributes({<br>  screen: &#39;Home&#39;,<br>  apiVersion: &#39;v2&#39;,<br>  featureFlag: &#39;new_checkout_enabled&#39;,<br>});</pre><p>Avoid logging:</p><ul><li>passwords</li><li>tokens</li><li>sensitive personal data</li></ul><p>Crash reports should improve debugging — not introduce security risks.</p><h3>⚠️ Common Issues Developers Face</h3><h3>Crash not appearing in dashboard</h3><p><strong>Solution: </strong>Restart app after triggering crash</p><h3>Crashlytics dashboard empty after setup</h3><p><strong>Solution:</strong> Trigger manual test crash:</p><pre>crashlytics().crash();</pre><p>Then relaunch app</p><h3>iOS crash reports missing</h3><p><strong>Solution: </strong>Try installing pods</p><pre>cd ios &amp;&amp; pod install</pre><p>Then rebuild project</p><h3>📊 Using Crashlytics with Remote Config (Powerful Combo)</h3><p>Crashlytics + Remote Config together enable:</p><ul><li>safe feature rollout</li><li>instant rollback strategies</li><li>controlled experiments</li><li>risk-free deployments</li></ul><p>Example workflow:</p><p>Enable feature remotely → Monitor Crashlytics → Disable instantly if crash spikes</p><p>Production teams use this strategy regularly.</p><h3>🎉 Final Thoughts</h3><p>Firebase Crashlytics helps developers detect production crashes early, understand failure patterns faster, and improve release stability with confidence.</p><p>Crashlytics gives engineering teams real visibility into what users experience after deployment.</p><p>If you’re building production React Native apps in 2026, Crashlytics should be part of your default Firebase setup alongside:</p><ul><li>Firebase Push Notifications</li><li>Firebase Analytics</li><li>Firebase Remote Config</li></ul><blockquote>The full working source code for Firebase Crashlytics integration in React Native is available here:<br><a href="https://github.com/ermohitpy/firebase/tree/crashlytics">https://github.com/ermohitpy/firebase/tree/crashlytics</a></blockquote><p>In the next article, I’ll cover how to use <strong>Firebase Authentication</strong> to authenticate app in production 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62216c3fa450" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚙️ Implement Firebase Remote Config in React Native (Feature Flags Without App Updates —…]]></title>
            <link>https://medium.com/@ermohit2k18/%EF%B8%8F-implement-firebase-remote-config-in-react-native-feature-flags-without-app-updates-77e9cc8dd80f?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/77e9cc8dd80f</guid>
            <category><![CDATA[firebase-remote-config]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 11:18:54 GMT</pubDate>
            <atom:updated>2026-04-02T11:18:54.265Z</atom:updated>
            <content:encoded><![CDATA[<h3>⚙️ Implement Firebase Remote Config in React Native (Feature Flags Without App Updates — Step-by-Step Guide 2026)</h3><p>Firebase Remote Config is one of the most powerful tools you can add to a React Native application. It allows you to change app behavior and UI dynamically <strong>without releasing a new app update</strong>.</p><p>This article is part of my React Native Firebase integration series, where I share production-ready implementations for Firebase services like push notifications, analytics, and now Remote Config.</p><p>In production apps, Firebase Remote Config allows developers to safely roll out features, experiment with UI behavior, and update app experience dynamically without releasing a new version.</p><p>In this guide, we’ll implement Firebase Remote Config in React Native using React Native Firebase with a production-ready setup.</p><h3>📦 Prerequisites</h3><p>Before starting:</p><p>React Native CLI project created<br>Firebase project configured<br>@react-native-firebase/app<br>installed</p><p>If you followed my previous Firebase setup guide or analytics article, you’re ready to continue.</p><h3>⚙️ Step 1: Install Firebase Remote Config</h3><p>Install dependency:</p><pre>npm install @react-native-firebase/remote-config</pre><blockquote><strong>Quick Fix: Firebase Version Mismatch</strong></blockquote><blockquote>One common pitfall when working with @react-native-firebase is version fragmentation. To avoid &quot;Dependency Hell,&quot; ensure all your Firebase modules (Auth, Analytics, etc.) are pinned to the same version. If an installation fails, don&#39;t rely on --force or --legacy-peer-deps—these can hide underlying issues. Instead, update your entire Firebase suite to the latest version to keep your environment synced and your builds running smoothly.</blockquote><p>For iOS:</p><pre>cd ios &amp;&amp; pod install</pre><p>❌ You might see a message like this in your terminal:</p><pre>[!] The following Swift pods cannot yet be integrated as static libraries:<br>The Swift pod `FirebaseCoreInternal` depends upon `GoogleUtilities`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers =&gt; true` for particular dependencies.<br>The Swift pod `FirebaseRemoteConfig` depends upon `FirebaseABTesting` and `GoogleUtilities`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers =&gt; true` for particular dependencies.</pre><p>This occurs when your Podfile isn&#39;t configured to handle the way Swift and Objective-C modules interact within the Firebase ecosystem.<br>The Solution: Updating your Podfile</p><p>To resolve this, you need to explicitly tell CocoaPods to use <strong>modular headers</strong> and treat the Firebase pods as <strong>static frameworks</strong>.</p><ol><li>Open your ios/Podfile.</li><li>Locate your target block and add the following configuration:</li></ol><pre># ... existing code ...<br><br>target &#39;YourProjectName&#39; do<br>  # 1. Enable modular headers globally<br>  use_modular_headers!<br>  config = use_native_modules!<br>  # ... rest of your pods ...<br>end</pre><h3>Final Steps</h3><p>Once you’ve updated the Podfile, clear your previous build state and reinstall the pods:</p><ol><li><strong>Navigate to the iOS folder:</strong> cd ios</li><li><strong>Clean and Install:</strong> rm -rf Pods &amp;&amp; pod install</li><li><strong>Rebuild:</strong> Return to your root directory and run npx react-native run-ios.</li></ol><p>By adding these lines, you ensure that the Swift-based Firebase modules can communicate perfectly with the rest of your React Native environment without manual header mapping.</p><p>Whenever you install a new Firebase dependency or update native configuration, it’s recommended to rebuild the Android project:</p><pre>cd android &amp;&amp; ./gradlew clean &amp;&amp; cd ..</pre><h3>🔥 Step 2: Enable Remote Config in Firebase Console</h3><p>Open : <br>Firebase Console → Remote Config</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gOfDlyKLC0Du1Lqm77SRpQ.png" /><figcaption>Remote Config dashboard</figcaption></figure><p>Click:<br>Create configuration</p><p>Now you can define parameters that control your app remotely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtGrU3ciWCpPtmFZ4v6Gog.png" /><figcaption>Edit Configuration</figcaption></figure><p>Example parameter:</p><pre>show_new_dashboard</pre><p>Default value:</p><pre>false</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uKfUJxNu8SzYobAeuE8DGg.png" /><figcaption>Publish changes in remote config console</figcaption></figure><p>Once published, we can fetch and use this value inside the application dynamically.</p><h3>📲 Step 3: Configure Remote Config Defaults</h3><p>Create helper:</p><pre>src/services/remoteConfigService.ts</pre><p>Example:</p><pre>import remoteConfig from &#39;@react-native-firebase/remote-config&#39;;<br>const remoteConfigInstance = getRemoteConfig();<br>export const setupRemoteConfig = async () =&gt; {<br>  await setDefaults(remoteConfigInstance, {<br>    show_new_dashboard: false,<br>  })<br>};</pre><p>This ensures fallback values exist even if Firebase hasn’t returned data yet.</p><h3>🔄 Step 4: Fetch Remote Config Values</h3><p>Fetch latest configuration from Firebase:</p><pre>//remoteConfigService.ts<br>export const fetchRemoteConfigValues = async () =&gt; {<br>  await fetchAndActivate(remoteConfigInstance).then(fetchedRemotely =&gt; {<br>    console.log(&#39;Remote config values fetched and activated:&#39;, fetchedRemotely);<br>  }).catch(error =&gt; {<br>    console.error(&#39;Error fetching remote config values:&#39;, error);<br>  });<br>};</pre><p>We use this in our setUp function as:</p><pre>//remoteConfigService.ts<br>export const setupRemoteConfig = async () =&gt; {<br>  await setDefaults(remoteConfigInstance, {<br>    show_new_dashboard: false,<br>  }).then(() =&gt; {<br>    console.log(&#39;Remote config defaults set successfully&#39;);<br>    fetchRemoteConfigValues();<br>  }).catch(error =&gt; {<br>    console.error(&#39;Error setting remote config defaults:&#39;, error);<br>  });<br>};</pre><p>Use inside App.tsx:</p><pre>useEffect(() =&gt; {<br>  setupRemoteConfig();<br>}, []);</pre><p>Now your app receives Remote Config values dynamically.</p><h3>🧪 Step 5: Read Remote Config Values Inside App</h3><p>With the defaults set and the remote values fetched from Firebase, we can now use the getValue method to get the value and use a number of methods to retrieve the value<br>Example:</p><pre>//remoteConfigService.ts<br>export const isNewDashboardEnabled =<br>  getValue(remoteConfigInstance, &#39;show_new_dashboard&#39;).asBoolean();</pre><p>The API also provides a getAll method to read all parameters at once rather than by key:</p><pre>//remoteConfigService.ts<br>const getAllRemoteConfigValues = () =&gt; {<br>  const allKeys = getAll(remoteConfigInstance);<br>  console.log(&#39;All remote config values:&#39;, allKeys);<br>  Object.entries(allKeys).forEach($ =&gt; {<br>    const [key, entry] = $;<br>    console.log(&#39;Key: &#39;, key);<br>    console.log(&#39;Source: &#39;, entry.getSource());<br>    console.log(&#39;Value: &#39;, entry.asString());<br>  });<br>}</pre><p>Usage example:</p><pre>//RemoteConfigDashboard.tsx<br>import { StyleSheet, Text, View } from &#39;react-native&#39;<br>import React from &#39;react&#39;<br>import { isNewDashboardEnabled } from &#39;../services/remoteConfigService&#39;;<br><br>const RemoteConfigDashboard = () =&gt; {<br><br>    console.log(&#39;Is new dashboard enabled:&#39;, isNewDashboardEnabled);<br><br>    if (isNewDashboardEnabled) {<br>        return (<br>            &lt;View style={[styles.container, styles.newContainer]}&gt;<br>                &lt;Text&gt;{&#39;New Dashboard&#39;}&lt;/Text&gt;<br>            &lt;/View&gt;<br>        )<br>    }<br><br>  return (<br>    &lt;View style={styles.container}&gt;<br>      &lt;Text&gt;{&#39;Old Dashboard&#39;}&lt;/Text&gt;<br>    &lt;/View&gt;<br>  )<br>}<br><br>export default RemoteConfigDashboard;<br><br>const styles = StyleSheet.create({<br>    container:{<br>        backgroundColor:&#39;#fff&#39;,<br>        flex: 1, <br>        justifyContent: &#39;center&#39;, <br>        alignItems: &#39;center&#39;<br>    },<br>    newContainer:{<br>        backgroundColor:&#39;#e0f7fa&#39;,<br>    }<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*nL60QqWAKeyPrQu51HQxoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*siB4gEdEVK5vtTZ_XSOZtw.png" /><figcaption>← android,ios →</figcaption></figure><p>Now your UI can change based on Remote Config.</p><h3>🎯 Step 6: Control Features Without Releasing New Version</h3><p>Example use case:</p><p>Enable feature remotely from Firebase Console → Remote Config:</p><pre>show_new_dashboard = true</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HzfJi2iuf6cqgYUmvV94cw.png" /><figcaption>edit param in remote config</figcaption></figure><p>Publish changes from Firebase Console. Your app behavior updates automatically after next fetch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*aSF0YpfyofhR5bA6GH4Vxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AegpAYkT_cY8xhpOP3Nmg.png" /><figcaption>← android,ios after remote config update→</figcaption></figure><h4>Value source</h4><p>Each Remote Config parameter also contains metadata about its source.</p><p>Using the `getSource()` method, we can identify whether the value came from:</p><p>remote (Firebase server)<br>default (local fallback value)<br>static (cached value)</p><p>Example:</p><pre>const checkSource = () =&gt; {<br>  const awesomeNewFeature = getValue(remoteConfigInstance, &#39;show_new_dashboard&#39;);<br><br>  if (awesomeNewFeature.getSource() === &#39;remote&#39;) {<br>    console.log(&#39;Parameter value was from the Firebase servers.&#39;);<br>  } else if (awesomeNewFeature.getSource() === &#39;default&#39;) {<br>    console.log(&#39;Parameter value was from a default value.&#39;);<br>  } else {<br>    console.log(&#39;Parameter value was from a locally cached value.&#39;);<br>  }<br>}</pre><p>This enables safer feature rollout strategies and allows teams to react quickly if something unexpected happens in production.</p><p>This enables safer feature rollout strategies and allows teams to react quickly if something unexpected happens in production.</p><p>Production apps rely heavily on this workflow.</p><h3>🧩 Step 7: Change Text Content Dynamically</h3><p>Remote Config is also useful for UI content updates.<br>Example :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hhxw_hYIWX5O2WNVXF8_Ng.png" /><figcaption>create param in remote config</figcaption></figure><pre>welcome_message</pre><p>Default value:</p><pre>Hi developers, Welcome to this demo app!!</pre><p>Read inside app:<br>Now , we use the function to get all values in a single fetch:</p><pre>//remoteConfigService.ts<br>export const getAllRemoteConfigValues = (setter: (data: RemoteConfigMap) =&gt; void) =&gt; {<br>  const allKeys = getAll(remoteConfigInstance);<br>  const configValues: RemoteConfigMap = {};<br><br>  Object.entries(allKeys).forEach(([key, entry]) =&gt; {<br>    // Extract the string value from the Firebase wrapper<br>    configValues[key] = entry.asString();<br>  });<br><br>  // Update the state with the clean object<br>  setter(configValues);<br>  <br>  return allKeys;<br>};</pre><p>Usage:</p><pre>//RemoteConfigDashboard.tsx<br>const [remoteData, setRemoteData] = useState&lt;RemoteConfigMap&gt;({});<br><br>    console.log(&#39;Is new dashboard enabled:&#39;, isNewDashboardEnabled);<br><br>    useEffect(() =&gt; {<br>        getAllRemoteConfigValues(setRemoteData);<br>    }, [])<br><br>    console.log(&#39;Remote config data in dashboard:&#39;, remoteData);<br><br>    if (remoteData.show_new_dashboard === &#39;true&#39;) {<br>        return (<br>            &lt;View style={[styles.container, styles.newContainer]}&gt;<br>                &lt;Text&gt;{&#39;New Dashboard&#39;}&lt;/Text&gt;<br>                &lt;Text style={{textAlign:&#39;center&#39;}}&gt;{`Welcome Message : ${remoteData?.welcome_message}`}&lt;/Text&gt;<br>            &lt;/View&gt;<br>        )<br>    }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*-fDQBTolGxTV5vpfOIg8dw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xuc7Wu9u-D14yiV4h1sNg.png" /><figcaption>← android ,ios →</figcaption></figure><p>Now we can update app text without new releases.</p><h3>🚀 Step 8: Set Fetch Interval</h3><p>By default Firebase caches Remote Config values for **12 hours**.</p><p>During development, we usually reduce this interval so that changes reflect instantly.</p><p>Example:</p><pre>//remoteConfigService.ts<br><br>setConfigSettings(remoteConfigInstance, {<br>    // for development, set to 0 to always fetch fresh values. In production, consider setting this to a higher value (e.g., 3600000 for 1 hour).<br>    minimumFetchIntervalMillis: __DEV__ ? 0 : 3600000,<br>  })</pre><p>This configuration:</p><p>uses real-time updates during development<br>uses 1 hour caching in production<br>reduces unnecessary network requests</p><h3>📡 When Remote Config Updates Apply</h3><p>Remote Config values update after:</p><pre>fetchAndActivate()</pre><p>This usually happens:</p><p>when the app launches<br>when the fetch interval expires<br>when manually triggered during development</p><p>Let’s now look at how Remote Config is used in real production React Native applications.</p><p>So always ensure your setup function runs during app startup.</p><h3>🚀 Production Use Cases of Firebase Remote Config</h3><p>Real apps use Remote Config for:</p><ul><li>feature flag rollout</li><li>force update workflows</li><li>A/B experimentation</li><li>personalized onboarding experiences</li><li>dynamic UI updates like banners or announcements</li><li>gradual feature rollout strategies</li><li>emergency rollback without app redeploy</li></ul><p>Example:<br>Enable feature only for 20% users</p><p>Remote Config handles this easily.</p><h3>🧱 Best Practices for Production Apps</h3><p>Always define default values:</p><pre>setDefaults(remoteConfigInstance, {<br>&#39;key&#39;:&#39;value&#39;<br>    })</pre><p>Use Remote Config with Analytics for experiments:</p><pre>A/B testing support</pre><p>Avoid fetching too frequently in production:</p><p>Default:</p><pre>12 hours fetch interval</pre><p>Track feature rollout impact using Analytics events.</p><h3>⚠️ Common Issues Developers Face</h3><ul><li>Remote Config values not updating instantly<br>Solution:<br>Reduce fetch interval during development: <br>minimumFetchIntervalMillis: 0</li><li>Values not applied after publish<br>Solution:<br>Call: fetchAndActivate()</li></ul><p>before reading values.</p><h3>🎉 Final Thoughts</h3><p>Firebase Remote Config allows you to control your application behavior dynamically without releasing new versions to the Play Store or App Store.</p><p>Remote Config gives developers the ability to control application behavior remotely, experiment safely, and respond quickly to production issues without shipping new releases.</p><p>If you’re building production React Native apps in 2026, Remote Config should be part of your default Firebase setup alongside:</p><ul><li>Firebase Analytics</li><li>Firebase Messaging</li></ul><blockquote>The full working source code for Firebase Remote Config integration in React Native is available here:<br><a href="https://github.com/ermohitpy/firebase/tree/remote-config">https://github.com/ermohitpy/firebase/tree/remote_config</a></blockquote><p>In the next article, I’ll cover how to use <strong>Firebase Crashlytics</strong> to detect crashes in production 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77e9cc8dd80f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ No More Third-Party Linear Gradient in React Native (React Native ≥ 0.76)]]></title>
            <link>https://medium.com/@ermohit2k18/no-more-third-party-linear-gradient-in-react-native-react-native-0-76-5e36f0efe1fb?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e36f0efe1fb</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 07:18:15 GMT</pubDate>
            <atom:updated>2026-03-27T07:18:15.777Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi developers 👋</p><p>There’s great news for React Native developers — you <strong>no longer need a third-party dependency like </strong><strong>react-native-linear-gradient</strong> to create gradient backgrounds in your app.</p><p>React Native introduced a new experimental style property:</p><pre>experimental_backgroundImage</pre><p>Using this property, you can apply <strong>linear gradients directly inside a View style</strong>, without installing any external library.</p><blockquote><em>⚠️ Note: This feature works only in </em><strong><em>React Native version 0.76 and above</em></strong><em>.</em></blockquote><p>This makes your app:</p><ul><li>lighter</li><li>faster to build</li><li>easier to maintain</li><li>free from extra dependencies</li><li>smaller in bundle size</li></ul><p>Let’s see how it works.</p><h3>📦 Previously: Using react-native-linear-gradient</h3><p>Earlier, we had to install:</p><pre>npm install react-native-linear-gradient</pre><p>Example usage:</p><pre>import LinearGradient from &#39;react-native-linear-gradient&#39;;<br><br>const GRADIENT = [&#39;#222795&#39;, &#39;#0E7E3D&#39;];<br>&lt;LinearGradient<br>  colors={GRADIENT}<br>  start={{ x: 0.3, y: 1 }}<br>  end={{ x: 1, y: 0.3 }}<br>  style={{<br>    height: &#39;5%&#39;,<br>    justifyContent: &#39;center&#39;,<br>    width: &#39;70%&#39;,<br>    alignItems: &#39;center&#39;,<br>  }}<br>&gt;<br>  &lt;Text style={{ color: &#39;white&#39;, fontSize: 20 }}&gt;<br>    This is a simple gradient<br>  &lt;/Text&gt;<br>&lt;/LinearGradient&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*7Aml1-MgIpq0r4p714DOJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t5cxnj8Ey-EEmH6oeKZhYw.png" /><figcaption>output in android &amp; iOS</figcaption></figure><h3>✨ Now: Create Gradient Without Any Dependency</h3><p>With React Native ≥ 0.76, you can create gradients like this:</p><pre>&lt;View<br>  style={{<br>    experimental_backgroundImage: `linear-gradient(${GRADIENT.join(&#39;, &#39;)})`,<br>    height: &#39;5%&#39;,<br>    justifyContent: &#39;center&#39;,<br>    alignItems: &#39;center&#39;,<br>  }}<br>&gt;<br>  &lt;Text style={{ color: &#39;white&#39;, fontSize: 20 }}&gt;<br>    This gradient is without any dependency<br>  &lt;/Text&gt;<br>&lt;/View&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*KGpynjNdXGWCaugzxjDh0g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqjx_B1LxT5AaF0jXlkLzQ.png" /><figcaption>Gradinet without any dependency</figcaption></figure><p>That’s it — no external library required.</p><h3>🎯 Add Gradient Direction (Angle Support)</h3><p>Previously, we used:</p><pre>start={{ x: 0.3, y: 1 }}<br>end={{ x: 1, y: 0.3 }}</pre><p>Now we can achieve the same effect using angles:</p><pre>experimental_backgroundImage:<br>  `linear-gradient(135deg, ${GRADIENT.join(&#39;, &#39;)})`</pre><p>This produces a gradient similar to directional gradients used in the dependency-based approach.</p><h3>🎨 Create Gradient Buttons Easily</h3><p>You can also apply gradients directly to buttons like:</p><pre>&lt;TouchableOpacity<br>  style={{<br>    experimental_backgroundImage:<br>      `linear-gradient(135deg, ${GRADIENT.join(&#39;, &#39;)})`,<br>    padding: 12,<br>    borderRadius: 8,<br>  }}<br>&gt;<br>  &lt;Text style={{ color: &#39;white&#39; }}&gt;<br>    Gradient Button<br>  &lt;/Text&gt;<br>&lt;/TouchableOpacity&gt;</pre><p>This removes the need for wrapping components with gradient containers.</p><h3>📱 Why This Is a Game Changer</h3><p>Using experimental_backgroundImage:</p><p>✅ removes dependency on third-party libraries<br>✅ reduces app bundle size<br>✅ improves maintainability<br>✅ simplifies gradient styling<br>✅ works directly inside View styles</p><p>For many use cases, this completely replaces react-native-linear-gradient.</p><h3>⚠️ Important Notes Before Using</h3><p>Keep these points in mind:</p><ul><li>Works only in <strong>React Native 0.76 and above</strong></li><li>Property is currently <strong>experimental</strong></li><li>API may slightly change in future releases</li><li>Always test gradients on both Android and iOS</li></ul><h3>🧪 Try More Gradient Variations</h3><p>You can experiment with:</p><pre>linear-gradient(45deg, red, blue)<br>linear-gradient(90deg, #222795, #0E7E3D)<br>linear-gradient(180deg, purple, orange)</pre><p>Just modify the angle and colors to match your UI needs.</p><blockquote>The complete working example used in this article is available here:<br><a href="https://github.com/ermohitpy/experimentalLinearGradient.git">https://github.com/ermohitpy/experimentalLinearGradient.git</a></blockquote><p>Readers can explore and directly integrate it into their projects.</p><h3>🎉 Final Thoughts</h3><p>React Native continues to improve rapidly, and features like experimental_backgroundImage show how the ecosystem is reducing reliance on third-party libraries.</p><p>If you’re building modern React Native apps using <strong>version 0.76 or newer</strong>, this approach is a clean and lightweight way to implement gradients without extra dependencies.</p><h3>Stay Connected 🚀</h3><p>I regularly share step-by-step React Native implementation guides covering:</p><ul><li>Firebase services</li><li>Modern React Native updates</li><li>Production-ready mobile app architecture tips</li></ul><p>If you’re building real-world React Native apps, follow along for more practical tutorials.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e36f0efe1fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Implement Firebase Analytics in React Native (Step-by-Step Guide — 2026 Edition)]]></title>
            <link>https://medium.com/@ermohit2k18/implement-firebase-analytics-in-react-native-step-by-step-guide-2026-edition-a8e551c63aa5?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e551c63aa5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 11:42:51 GMT</pubDate>
            <atom:updated>2026-03-26T11:42:51.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Firebase Analytics is one of the most powerful tools you can add to a React Native application. It helps you understand <strong>how users interact with your app in real time</strong> so you can improve engagement, retention, and conversion.</p><blockquote><em>This article is part of my React Native Firebase integration series, where I share production-ready implementations for firebase services i.e push notifications, analytics, and remote config.</em></blockquote><p>In production apps, Firebase Analytics is commonly used for:</p><ul><li>tracking user behavior</li><li>measuring screen usage</li><li>monitoring feature adoption</li><li>understanding conversion funnels</li><li>improving onboarding flows</li><li>running A/B experiments with Remote Config</li></ul><p>In this guide, we’ll implement <strong>Firebase Analytics in React Native using React Native Firebase</strong> with a production-ready setup.</p><h3>📦 Prerequisites</h3><p>Before starting:</p><ul><li>React Native CLI project created</li><li>Firebase project configured</li><li>@react-native-firebase/app installed</li></ul><p>If you followed my previous Firebase setup guide or push notification article, you’re ready to continue.</p><h3>⚙️ Step 1: Install Firebase Analytics</h3><p>Install dependency:</p><pre>npm install @react-native-firebase/analytics</pre><p>Open : /android/app/build.gradle</p><pre>dependencies {<br>    ...<br>    // For trigger analytics<br>    implementation(&quot;com.google.firebase:firebase-analytics&quot;)<br>    //Add this line -----^-----<br>    ...<br>}</pre><blockquote>Whenever you make changes in the Android setup or install new Firebase dependencies, it’s a good practice to clean the Android build and rebuild the project: cd android &amp;&amp; ./gradlew clean &amp;&amp; cd ..</blockquote><p>For iOS:</p><pre>npx pod-install</pre><h3>🔥 Step 2: Enable Analytics in Firebase Console</h3><p>Open:</p><p>Firebase Console → Analytics Dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDCKoNu4n6fAwyFkDSjqOQ.png" /><figcaption>Analytics Dashboard</figcaption></figure><p>By default its already enabled and if it isn’t enabled yet</p><p>Click: Enable Analytics</p><h3>What does it do</h3><p>Analytics collects usage and behavior data for your app. Its two primary concerns are:</p><ul><li><strong>Events</strong>: What is happening in your app, such as user actions, system events, or errors.</li><li><strong>User properties</strong>: Attributes you define to describe segments of your user base, such as language preference or geographic location.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gZ1adUUlmUbQ53I_Glx9ew.png" /><figcaption>Events</figcaption></figure><p>Analytics automatically logs some events and user properties; you don’t need to add any code to enable them. However, Analytics also allows you to log custom or predefined events within your app. How you can do this will be explained below.</p><h3>📲 Step 3: Track Custom Events</h3><p>Tracking custom events helps measure <strong>real user interactions inside your app</strong>.</p><p>Example: Track when a user applies for a loan.</p><p>Create helper: src/services/analyticsServices.ts</p><p>Example:</p><pre>import analytics from &#39;@react-native-firebase/analytics&#39;;<br><br>export const trackApplyLoanEvent = async () =&gt; {<br>  await analytics().logEvent(&#39;apply_loan_clicked&#39;);<br>};</pre><p>Use it like:</p><pre>--------------------<br><br> &lt;Button title=&#39;Apply Loan&#39; onPress={trackApplyLoanEvent} /&gt;<br><br>--- rest of code ---</pre><p>Now the event appears in Firebase Analytics dashboard.</p><h3>🧭 Step 4: Track Screen Views (Important)</h3><p>By default, React Native does <strong>not automatically track screen navigation</strong> like native apps.</p><p>So we manually track screen views.</p><p>Example:</p><pre>import analytics from &#39;@react-native-firebase/analytics&#39;;<br><br>export const trackScreenView = async (screenName: string) =&gt; {<br>  await analytics().logScreenView({<br>    screen_name: screenName,<br>    screen_class: screenName,<br>  });<br>};</pre><p>Usage inside screen:</p><pre>useEffect(() =&gt; {<br>  trackScreenView(&#39;AnalyticsScreen&#39;);<br>}, []);</pre><p>Now Firebase shows screen-level analytics.</p><p>And for track screen navigation automatically we can enter analytics in our navigator . i.e:</p><pre>import { NavigationContainer } from &#39;@react-navigation/native&#39;;<br><br>const navigationRef: React.RefObject&lt;any&gt; = createRef();<br><br>const routeNameRef = useRef();<br><br>&lt;NavigationContainer ref={navigationRef}<br>      onReady={() =&gt; (routeNameRef.current = navigationRef.current.getCurrentRoute().name)}<br>      onStateChange={async () =&gt; {<br>        try {<br>          const previousRouteName = routeNameRef.current;<br>          const currentRouteName = navigationRef.current.getCurrentRoute().name;<br>          if (previousRouteName !== currentRouteName) {<br>            await analytics().logScreenView({<br>              screen_name: currentRouteName,<br>              screen_class: currentRouteName,<br>            });<br>          }<br>          routeNameRef.current = currentRouteName;<br>        } catch (error) {<br>          console.log(&#39;====errorNavigation&gt;&gt;&gt;&#39;, error);<br>        }<br>      }}<br>    &gt;<br>      {renderedNavigator}<br>&lt;/NavigationContainer&gt;</pre><p>After do so when the user navigate then the screen logged</p><h3>👤 Step 5: Track User Properties</h3><p>User properties help segment users based on behavior or profile.</p><p>Example:</p><pre>await analytics().setUserProperty(<br>  &#39;customer_type&#39;,<br>  &#39;dealer&#39;<br>);</pre><p>Examples of useful properties:</p><ul><li>customer_type</li><li>subscription_plan</li><li>user_role</li><li>onboarding_completed</li></ul><p>These help create targeted analytics reports.</p><h3>🆔 Step 6: Track Logged-in Users</h3><p>If your app has authentication, assign user IDs:</p><pre>//Generally we do this when user logged in<br>export const setUserIdInAnalytics = async (userId: number) =&gt; {<br>    try {<br>        await setUserId(analyticsInstance, userId.toString());<br>    } catch (error) {<br>        console.log(&#39;===errorInSetUserID&gt;&gt;&#39;, error);<br>    }<br>};</pre><p>This allows:</p><ul><li>tracking individual journeys</li><li>building funnels</li><li>analyzing retention</li></ul><p>Production apps always implement this.</p><h3>🎯 Step 7: Example — Track Button Click Event</h3><p>Example:</p><pre>await analytics().logEvent(&#39;download_document_clicked&#39;, {<br>  document_type: &#39;PAN_CARD&#39;,<br>});</pre><p>Now Firebase tracks:</p><p>event_name → download_document_clicked<br>parameter → document_type</p><p>You can filter analytics reports using parameters.</p><h3>📊 Step 8: View Analytics Data in Firebase Console</h3><p>During development, Firebase Analytics <strong>does log events</strong>, but they may not appear immediately in the standard Analytics reports.</p><p>Here’s what to expect:</p><ul><li>Events do <strong>not appear instantly</strong> in standard dashboards</li><li>Events <strong>appear immediately in DebugView</strong></li><li>Standard reports may take <strong>up to 24 hours</strong> to update</li></ul><p>So while testing your implementation, always check events inside:<br>Firebase Console → Analytics → DebugView</p><p>This is the correct place to verify whether your events are being tracked properly during development.</p><p><strong>Enable DebugView on Android<br></strong>Run the following command in your terminal:</p><pre>adb shell setprop debug.firebase.analytics.app your.package.name</pre><p>Example:</p><pre>adb shell setprop debug.firebase.analytics.app com.myapp</pre><p><strong>Enable DebugView on iOS<br></strong>Add this launch argument inside Xcode:</p><pre>-FIRDebugEnabled</pre><p>After enabling DebugView, your logged events will appear instantly here:<br>Firebase Console → Analytics → DebugView</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dqllf9qqedz070ismmFAJw.png" /><figcaption>Debug View</figcaption></figure><p><strong>View Events in Analytics Reports<br></strong>To explore detailed analytics insights, open:<br>Firebase Console → Analytics → Events</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIiKZ73o47SvTLv39VD8uw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlMZYnLgYvsltWpX36h5Hg.png" /><figcaption>&lt;-Events Dashboard-&gt;</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhckrwbJsgHdD6y7KDiv1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkzuBNZNtSqAlkuceZMz9Q.png" /><figcaption>Realtime Dashboard</figcaption></figure><p>Here you can monitor:</p><ul><li>event frequency</li><li>user activity</li><li>engagement trends</li><li>retention metrics</li></ul><p><strong>Realtime Analytics<br></strong>To see live active users in your application, visit:<br>Firebase Console → Realtime<br>This section shows user activity instantly while your app is running.</p><h3>🚀 Production Use Cases of Firebase Analytics</h3><p>Real apps use Analytics for:</p><ul><li>onboarding funnel tracking</li><li>feature adoption measurement</li><li>identifying drop-off screens</li><li>measuring notification engagement</li><li>tracking conversion events</li><li>monitoring retention behavior</li></ul><p>Example funnel: <br>Login → Apply Loan → Upload Document → Approved</p><p>Analytics shows where users drop off.</p><h3>🧱 Best Practices for Production Apps</h3><p>Always use lowercase event names:</p><pre>apply_loan_clicked<br>document_uploaded<br>profile_completed</pre><p>Avoid spaces in event names.</p><p>Use consistent naming convention:</p><pre>screen_view_home<br>screen_view_profile<br>screen_view_dashboard</pre><p>Track important user journeys only. Avoid logging unnecessary events.</p><h3>⚠️ Common Issues Developers Face</h3><p><strong>Events not appearing instantly<br></strong>Analytics events take time:</p><pre>30 seconds → Realtime<br>24 hours → Standard dashboard</pre><p><strong>Events visible locally but not in production<br></strong>Solution:<br>Check: Analytics enabled in Firebase project</p><p><strong>Screen tracking not working<br></strong>Solution: Manually implement:</p><pre>logScreenView()</pre><p>for each screen.</p><h3>🎉 Final Thoughts</h3><p>Firebase Analytics helps you understand <strong>how users interact with your app</strong>, which screens perform best, and where users drop off.</p><p>Using <strong>React Native Firebase Analytics</strong> allows you to:</p><ul><li>track screen usage</li><li>measure feature adoption</li><li>analyze user journeys</li><li>improve retention</li><li>optimize conversion funnels</li></ul><p>If you’re building production React Native apps in 2026, Analytics should be part of your default setup.</p><blockquote>In this guide, we’ll implement Firebase Analytics in React Native using React Native Firebase with a production-ready setup.<br>The full working source code for Firebase Analytics integration in React Native is available here:<br> <a href="https://github.com/ermohitpy/firebase/tree/analytics">https://github.com/ermohitpy/firebase/tree/analytics</a></blockquote><p>In the next article, I’ll cover how to use <strong>Firebase Remote Config</strong> to control features remotely without releasing a new app version.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e551c63aa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Production-Ready Push Notifications in React Native using Firebase + Notifee (Step‑by‑Step Guide…]]></title>
            <link>https://medium.com/@ermohit2k18/production-ready-push-notifications-in-react-native-using-firebase-notifee-step-by-step-guide-41ad210b136b?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/41ad210b136b</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[mobile-development]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 17:48:16 GMT</pubDate>
            <atom:updated>2026-03-24T17:48:16.766Z</atom:updated>
            <content:encoded><![CDATA[<h3>🔔<strong> Production-Ready Push Notifications in React Native using Firebase + Notifee (Step‑by‑Step Guide — 2026 Edition)</strong></h3><p>Push notifications are one of the most powerful engagement tools in modern mobile apps. Whether you’re building a chat app, ecommerce platform, fintech dashboard, or productivity tool — notifications keep users returning.</p><p>In my <strong>previous React Native Firebase setup article</strong>, we already covered:</p><ul><li>Creating a React Native project</li><li>Creating a Firebase project</li><li>Adding Android app to Firebase</li><li>Adding iOS app to Firebase</li></ul><p>So in this guide we’ll <strong>continue from there</strong> and implement <strong>production‑ready push notifications using Firebase Cloud Messaging + Notifee</strong>.</p><p>By the end of this tutorial your app will support:</p><p>✅ Foreground notifications<br>✅ Background notifications<br>✅ Terminated state notifications<br>✅ Android notification channels<br>✅ Token management<br>✅ Navigation from notifications (deep linking ready setup)</p><p>This setup reflects <strong>industry‑standard React Native notification architecture in 2026</strong>.</p><h3>Step 1: Install Firebase Messaging Dependency</h3><p>Since Firebase is already configured from the previous article, install messaging support:</p><pre>npm install @react-native-firebase/messaging</pre><p>Then install Notifee for foreground handling:</p><blockquote>By default, Firebase does not display notifications when the app is in the foreground. To handle this scenario, we use <strong>Notifee</strong> to manually show notifications. However, depending on your use case, you can also implement alternatives such as in-app notifications, custom UI banners, or even a simple alert message.</blockquote><pre>npm install @notifee/react-native</pre><blockquote>Why notifee?</blockquote><blockquote>Notifee gives better control over foreground notifications, notification channels, actions, grouping, and advanced Android notification behavior compared to the default Firebase handler.</blockquote><p>For iOS:</p><pre>npx pod install</pre><h3>Step 2: Request Notification Permission</h3><p>Before requesting permission inside JavaScript, first add native permissions for <strong>Android</strong> and <strong>iOS</strong>.</p><h3>Android Setup</h3><p>Open: /android/app/src/main/AndroidManifest.xml</p><p>Add:</p><pre>&lt;uses-permission android:name=&quot;android.permission.POST_NOTIFICATIONS&quot; /&gt;</pre><p>This permission is required for Android 13+ devices.</p><h3><strong>iOS Setup</strong></h3><p>To use APNs(Apple Push Notification Services) with Firebase, you need to generate an <strong>APNs Authentication Key</strong> (.p8 file) in your Apple Developer Member Center and upload it to the Firebase console. This key is recommended over certificates as it does not expire and can be used for all your apps.</p><p><strong>Step 1: Generate the APNs Authentication Key</strong></p><ol><li>Log in to your Apple Developer Account and navigate to <strong>Certificates, Identifiers &amp; Profiles</strong>.</li><li>In the left sidebar, select <strong>Keys</strong>, then click the plus (<strong>+</strong>) button to create a new key.</li><li>Give the key a descriptive name (e.g., “Firebase APNs Key”).</li><li>Enable the <strong>Apple Push Notification service (APNs)</strong> checkbox.</li><li>Click <strong>Continue</strong>, then <strong>Register</strong>.</li><li>On the confirmation page, note the 10-character <strong>Key ID</strong> and your <strong>Team ID</strong> (found in the top right corner of the page under your name).</li><li>Click <strong>Download</strong> to save the .p8 file to your computer.</li></ol><blockquote><strong>Important:</strong> The key file can only be downloaded once, so save it in a secure place.</blockquote><p><strong>Step 2: Upload the Key to Firebase</strong></p><ol><li>Go to the Firebase Console and open your project.</li><li>Click the gear icon (⚙️) next to <strong>Project Overview</strong> and select <strong>Project Settings</strong>.</li><li>Navigate to the <strong>Cloud Messaging</strong> tab.</li><li>Scroll down to the <strong>iOS app configuration</strong> section.</li><li>Under <strong>APNs authentication key</strong>, click the <strong>Upload</strong> button.</li><li>Select the downloaded .p8 file.</li><li>Enter the <strong>Key ID</strong> and <strong>Team ID</strong> in the provided fields.</li><li>Click <strong>Upload</strong> to complete the process.</li></ol><p><strong>Step 3: Configure Your Xcode Project</strong></p><p>Ensure your iOS app in Xcode has the necessary capabilities enabled.</p><ol><li>Open your project in Xcode.</li><li>Select your project in the Project Navigator, then select your target.</li><li>Go to the <strong>Signing &amp; Capabilities</strong> tab.</li><li>Add the <strong>Push Notifications</strong> capability.</li><li>Add the <strong>Background Modes</strong> capability and check the box for <strong>Remote notifications</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*igR84zqpYFcts06CYHItqw.png" /><figcaption>Adding Push Notification</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*d6a1dLwQx1mbKoELQP3Wgw.png" /><figcaption>Adding Background Modes</figcaption></figure><p>Now create a helper service at:src/services/notificationService.ts</p><pre>//notificationService.ts<br>export async function requestUserPermission() {<br>    const messagingInstance = getMessaging();<br><br>    const authStatus = await requestPermission(messagingInstance);<br>    const isEnabled =<br>        authStatus === AuthorizationStatus.AUTHORIZED ||<br>        authStatus === AuthorizationStatus.PROVISIONAL;<br><br>    if (isEnabled) {<br>        if (Platform.OS === &#39;android&#39;) {<br>            const isPermission = await PermissionsAndroid.request(<br>                PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS<br>            );<br>            if (isPermission === PermissionsAndroid.RESULTS.GRANTED) {<br>                console.log(&#39;Notification permission granted&#39;);<br>                return true;<br>            } else {<br>                console.log(&#39;Notification permission not granted&#39;);<br>                return false;<br>            }<br>        }<br>        console.log(&#39;Notification permission granted&#39;);<br>        return true;<br>    } else {<br>        console.log(&#39;Notification permission not granted&#39;);<br>        return false;<br>    }<br>}</pre><p>Call this when app launches. So, we put it in <strong>App.tsx</strong>:</p><pre>useEffect(() =&gt; {<br>    requestUserPermission();<br>  }, [])</pre><h3>Step 3: Get FCM Device Token</h3><p>Each device receives a unique token.</p><pre>export async function getFCMToken() {<br>    const token = await getMessaging().getToken();<br>    console.log(&#39;FCM Token:&#39;, token);<br>    return token;<br>}</pre><p>trigger this function after taking user permission ,i.e:</p><pre>useEffect(() =&gt; {<br>    requestUserPermission().then((result) =&gt; {<br>      if (result) getFCMToken()<br>    }).catch((e) =&gt; console.error(&#39;error in fcm token&#39;, e))<br>  }, [])</pre><p>Store this token inside your backend.</p><blockquote>Always store FCM tokens per user instead of per device if your app supports authentication.</blockquote><blockquote>Push Notification Flow Architecture:</blockquote><blockquote>User Device → Firebase Cloud Messaging → Backend → React Native App</blockquote><p>This enables:</p><ul><li>targeted notifications</li><li>broadcast notifications</li><li>scheduled notifications</li></ul><h3>Step 4: Create Android Notification Channel<strong>(Only needed when using Notifee)</strong></h3><p>Required for Android 8+</p><p>Add:</p><pre>import notifee, { AndroidImportance } from &#39;@notifee/react-native&#39;;<br>export async function createNotificationChannel() {<br>    await notifee.createChannel({<br>        id: &#39;default&#39;,<br>        name: &#39;Default Channel&#39;,<br>        importance: AndroidImportance.HIGH,<br>    });<br>}</pre><p>Call once during app startup:</p><pre>//index.js<br>import { AppRegistry, Platform } from &#39;react-native&#39;;<br>import App from &#39;./App&#39;;<br>import { name as appName } from &#39;./app.json&#39;;<br>import { createNotificationChannel } from &#39;./src/services/notificationService&#39;;<br><br>if (Platform.OS === &#39;android&#39;) {<br>    createNotificationChannel();<br>}<br><br>AppRegistry.registerComponent(appName, () =&gt; App);</pre><h3>Step 5: Handle Foreground Notifications</h3><p>React Native does <strong>not automatically show notifications in foreground mode </strong>as mentioned above.</p><p>So we manually display them using Notifee.</p><pre>// App.tsx<br>useEffect(() =&gt; {<br>    const unsubscribeForeground = foregroundNotificationListener();<br>  <br>    return () =&gt; {<br>      // remove listener on unmount<br>      unsubscribeForeground();<br>    };<br>  }, []);<br><br>//notificationService.ts<br>import notifee from &#39;@notifee/react-native&#39;;<br>export function foregroundNotificationListener() {<br>    return getMessaging().onMessage(async remoteMessage =&gt; {<br>        await notifee.displayNotification({<br>          title: remoteMessage?.notification?.title,<br>          body: remoteMessage?.notification?.body,<br>          android: {<br>            channelId: &#39;default&#39;,<br>          },<br>        });<br>      });<br>}</pre><p>This ensures users receive notifications even while actively using the app.</p><h3>Step 6: Handle Background Notifications</h3><p>Open: index.js</p><p>Add:</p><pre>getMessaging().setBackgroundMessageHandler(async remoteMessage =&gt; {<br>    console.log(&#39;Message handled in background:&#39;, remoteMessage);<br>});</pre><p>Now notifications work when app is minimized.</p><h3>Step 7: Handle Notifications When App Is Closed</h3><p>Open <strong>App.tsx</strong>:</p><pre>//App.tsx<br>useEffect(() =&gt; {<br>    getMessaging()<br>      .getInitialNotification()<br>      .then(remoteMessage =&gt; {<br>        if (remoteMessage) {<br>          console.log(&#39;App opened from quit state&#39;);<br>        }<br>      });<br>  }, []);</pre><p>This helps enable navigation when notification is tapped.</p><h3>Step 8: Navigate User When Notification Is Clicked (Deep Linking Setup)</h3><p>By default, tapping a notification opens the app. However, you can customize this behavior to navigate users to a specific screen or perform certain actions using the data payload sent with the notification.</p><p>Example:</p><pre>useEffect(() =&gt; {<br>    getMessaging().onNotificationOpenedApp(remoteMessage =&gt; {<br>      if (remoteMessage?.data?.screen === &#39;OrderDetails&#39;) {<br>        // do whatever you want i.e navigate user to somewhere<br>      }<br>    });<br>  }, [])</pre><p>Now your notifications can drive real user engagement flows.</p><p>Example payload:</p><pre>{<br>    &quot;to&quot;: &quot;device_token&quot;,<br>      &quot;notification&quot;: {<br>      &quot;title&quot;: &quot;Order shipped 🚚&quot;,<br>        &quot;body&quot;: &quot;Your order #1234 is on the way!&quot;<br>    },<br>    &quot;data&quot;: {<br>      &quot;screen&quot;: &quot;OrderDetails&quot;<br>    }<br>}</pre><h3>Step 9: Handle Token Refresh Automatically</h3><p>FCM tokens may change automatically over time, so it’s important to listen for token refresh events and update your backend whenever a new token is generated. Otherwise, notifications may silently stop working for some users.</p><p>So always listen for updates:</p><pre>//App.tsx<br>useEffect(() =&gt; {<br>    const unsubscribeTokenRefresh = tokenRefreshListener();<br><br>    return () =&gt; {<br>      // remove listener on unmount<br>      unsubscribeTokenRefresh();<br>    };<br>  }, []);<br><br>//notificationService.ts<br>export function tokenRefreshListener() {<br>    return getMessaging().onTokenRefresh(token =&gt; {<br>        console.log(&#39;New token:&#39;, token);<br>        // send token to backend here<br>    });<br>}</pre><p>Send updated token to backend.</p><h3>Step 10: Send Test Notification from Firebase Console</h3><p>Open: Firebase Console → Cloud Messaging</p><p>Click: Send test message</p><p><strong>Paste device token.</strong></p><p>Send.</p><p>You should receive notification instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*eqkM6kSM2z_BKjWNGAu4jw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*b1yrAWK8nbc8Jg5DP5aW2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*eikVPicdLbVmGlvTVmtFHQ.png" /><figcaption>Notification received in terminated, foreground and background state.</figcaption></figure><blockquote>If you’d like to explore the complete implementation, including service structure and listener setup, check out the full working example here:</blockquote><blockquote><a href="https://github.com/ermohitpy/firebaseSetUp">https://github.com/ermohitpy/firebaseSetUp</a></blockquote><p><strong>Production Best Practices (Important)</strong></p><ul><li><em>Always store tokens in backend database</em></li><li><em>Use topics for broadcast notifications:</em></li><li><em>messaging().subscribeToTopic(‘news’);</em></li><li><em>Set HIGH priority in Android payload</em></li><li><em>Upload APNs key inside Firebase Console for iOS</em></li><li><em>Use data‑only payloads for advanced workflows</em></li></ul><h3>Common Issues Developers Face</h3><p>Notifications not received in foreground</p><p><strong>Solution:</strong> Use Notifee displayNotification()</p><p>Android notifications delayed</p><p><strong>Solution:</strong> Set HIGH priority in payload</p><p>iOS notifications not working</p><p><strong>Solution:</strong> Upload APNs authentication key</p><p><strong>Final Thoughts</strong></p><p>Push notifications dramatically improve retention and engagement when implemented correctly.</p><p>Using <strong>Firebase Messaging + Notifee + React Native Firebase</strong> gives you a complete production‑ready system supporting:</p><ul><li>foreground</li><li>background</li><li>terminated state</li><li>navigation flows</li><li>analytics ready delivery</li></ul><p>If you’re building any serious React Native app in 2026, this setup is considered the industry standard.</p><p>Thanks for taking the time to read this article! If you found it helpful, feel free to follow me for more React Native and Firebase implementation guides.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41ad210b136b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Firebase Setup in React Native for Beginners (Step-by-Step Guide) ]]></title>
            <link>https://medium.com/@ermohit2k18/firebase-setup-in-react-native-for-beginners-step-by-step-guide-ec5f9150bc24?source=rss-2de3934ac80b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec5f9150bc24</guid>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[firebase]]></category>
            <dc:creator><![CDATA[Mohit]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 11:17:21 GMT</pubDate>
            <atom:updated>2026-03-18T11:17:21.754Z</atom:updated>
            <content:encoded><![CDATA[<p>Firebase Setup in React Native for Beginners (Step-by-Step Guide) 🚀</p><p>Setting up Firebase in React Native can feel a bit confusing at first — especially for beginners.</p><p>In this guide, I’ll break everything down into simple, easy-to-follow steps so you can integrate Firebase smoothly into your app without any hassle.</p><p>If you follow along step by step, you should be able to set everything up without issues. And even if you get stuck somewhere, feel free to reach out — I’ll be happy to help!</p><p>👉 In upcoming posts, I’ll also cover how to use Firebase services like:</p><ul><li>Push Notifications 🔔</li><li>Firebase Storage 📦</li><li>Remote Config ⚙️</li><li>Crashlytics 🛠️</li><li>Analytics 📊</li><li>Social Login 🔐</li></ul><p>So stay tuned 🚀</p><p><strong>Step 1 :</strong> Create a New React Native Project</p><p>Let’s start by creating a new React Native project. Run the following command in your terminal:</p><pre>npx @react-native-community/cli init {app name}</pre><p>This command creates a new React Native project with the latest configuration.</p><p>👉 If you plan to run the app on iOS, make sure you have <strong>CocoaPods</strong> installed. The CLI usually prompts you during setup, but you can install it manually if needed.</p><p><strong>Step 2: </strong>Run the Project</p><p>Once the project is created, open it in your preferred IDE (VS Code, Cursor, Windsurf, etc.).</p><p>Now run the project:</p><h3>For Android:</h3><pre>npx react-native run-android</pre><h3>For iOS:</h3><pre>cd ios &amp;&amp; pod install &amp;&amp; cd ..<br>npx react-native run-ios</pre><p>If everything is set up correctly, you should see the default React Native welcome screen on both platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*09_qi5jSIBLx-mNIQ-x0GA.png" /><figcaption>Android Welcome Screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5EonPQ5XCEUCTgAafywcQ.png" /><figcaption>iOS Welcome Screen</figcaption></figure><h3>Step 3: Install Firebase</h3><p>Install the Firebase core module:</p><h3>Using npm:</h3><pre>npm install @react-native-firebase/app</pre><h3>Using yarn:</h3><pre>yarn add @react-native-firebase/app</pre><h3>Step 4: Create a Firebase Project</h3><ol><li>Go to the Firebase Console</li><li>Click <strong>“Create Project”</strong></li><li>Enter your project name</li><li>Accept the terms and continue</li></ol><p>🎉 Your Firebase project is now ready!</p><h3>Step 5: Add Android App to Firebase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nM3-cLarl_fHCV4mhN3rjA.png" /><figcaption>Add Android App</figcaption></figure><ol><li>Click <strong>“Add App” → Android</strong></li><li>Enter your <strong>package name</strong></li></ol><p>You can find it here:</p><pre>/android/app/build.gradle</pre><p>Search for:</p><pre>applicationId &quot;com.yourappname&quot;</pre><ol><li>Click <strong>Register App</strong></li><li>Download google-services.json</li><li>Place it here:</li></ol><pre>/android/app/google-services.json</pre><h3>Enable Firebase in Android</h3><h4>1. Open:</h4><p>/android/build.gradle</p><p>Add:</p><pre>buildscript {<br>  dependencies {<br>    // ... other dependencies<br>    classpath &#39;com.google.gms:google-services:4.4.4&#39;<br>    // Add me --- /\<br>  }<br>}</pre><h4>2. Open:</h4><p>/android/app/build.gradl</p><p>Add:</p><pre>apply plugin: &quot;com.android.application&quot;<br>apply plugin: &quot;org.jetbrains.kotlin.android&quot;<br>apply plugin: &quot;com.facebook.react&quot;<br>apply plugin: &#39;com.google.gms.google-services&#39;</pre><p>Now just click next , continue to console on the firebase. Your firebase is now successfully set up in your android app.</p><h3>Step 6: Add iOS App to Firebase</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9fIZxyD9amj43g2GfKIbtw.png" /><figcaption>Add iOS App</figcaption></figure><ol><li>Click <strong>“Add App” → iOS</strong></li><li>Enter your <strong>Bundle Identifier</strong></li></ol><p>Find it in Xcode:</p><pre>General → Bundle Identifier</pre><ol><li>Download GoogleService-Info.plist</li></ol><h3>Add plist File in Xcode</h3><p>⚠️ Do NOT copy-paste manually.</p><p>Instead:</p><ul><li>Open Xcode</li><li>Right-click on your project</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qIrTb3jyITqUfs8qD6sNAw.png" /><figcaption>Step 1 in xcode</figcaption></figure><ul><li>Click <strong>“Add Files to [Project Name]”</strong></li><li>Select the .plist file</li><li>Check ✅ <em>Copy items if needed</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*muPjd8uUjWAvDJgQVq5p8g.png" /><figcaption>step 2 select action to Copy files to destination</figcaption></figure><ul><li>Click <strong>Finish</strong></li></ul><h3>Step 7: Configure Firebase in iOS</h3><p>Open:</p><p>/ios/{projectName}/AppDelegate.swift</p><p>Add:</p><pre>import Firebase</pre><p>Inside didFinishLaunchingWithOptions:</p><pre>FirebaseApp.configure()</pre><h3>Update Podfile</h3><p>Open:</p><p>/ios/Podfile</p><p>Add:</p><pre>use_frameworks! :linkage =&gt; :static<br>$RNFirebaseAsStaticFramework = true</pre><p>Then run:</p><pre>cd ios &amp;&amp; pod install</pre><h3>Step 8: Verify Firebase Setup</h3><p>Rebuild your app and add this in App.tsx:</p><pre>import firebase from &#39;@react-native-firebase/app&#39;;</pre><pre>console.log(&quot;Firebase App Initialized:&quot;, firebase.apps.length &gt; 0);</pre><p>If you see:</p><pre>Firebase App Initialized: true</pre><p>🎉 Boom! Firebase is successfully connected to your app.</p><blockquote>💡 Want to see the full implementation?<br> I’ve pushed the complete setup to GitHub — <a href="https://github.com/ermohitpy/firebaseSetUp">check it out here</a></blockquote><blockquote>📚 For deeper insights and advanced use cases, I highly recommend exploring the official <a href="https://rnfirebase.io/"><strong>React Native Firebase</strong></a> documentation.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec5f9150bc24" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>