<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abhishek Jain</title>
    <description>The latest articles on DEV Community by Abhishek Jain (@maniactech).</description>
    <link>https://dev.to/maniactech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1005963%2F7fa878da-a4ce-4677-b282-d8b6d6a78349.jpeg</url>
      <title>DEV Community: Abhishek Jain</title>
      <link>https://dev.to/maniactech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maniactech"/>
    <language>en</language>
    <item>
      <title>@maniac-tech/react-native-expo-read-sms v3.0.0</title>
      <dc:creator>Abhishek Jain</dc:creator>
      <pubDate>Wed, 10 Jan 2024 05:40:57 +0000</pubDate>
      <link>https://dev.to/maniactech/maniac-techreact-native-expo-read-sms-v300-2k4</link>
      <guid>https://dev.to/maniactech/maniac-techreact-native-expo-read-sms-v300-2k4</guid>
      <description>&lt;p&gt;Today I released &lt;strong&gt;&lt;em&gt;v3.0.0&lt;/em&gt;&lt;/strong&gt; of &lt;em&gt;@maniac-tech/react-native-expo-read-sms&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Highlights:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upgrade react-native to version 0.70.8, supporting Expo v47&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Find the change log here: &lt;u&gt;&lt;a href="https://github.com/maniac-tech/react-native-expo-read-sms/releases/tag/v3.0.0"&gt;https://github.com/maniac-tech/react-native-expo-read-sms/releases/tag/v3.0.0&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Want to read about how to use the library? Refer: &lt;u&gt;&lt;a href="https://medium.com/@maniac-tech/read-otp-sms-expo-react-native-android-14b702c43623"&gt;https://medium.com/@maniac-tech/read-otp-sms-expo-react-native-android-14b702c43623&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Library’s public website: &lt;u&gt;&lt;a href="https://maniac-tech.com/expo-read-sms/"&gt;https://maniac-tech.com/expo-read-sms/&lt;/a&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;You can find the sample app using the library on GitHub here.&lt;/p&gt;

&lt;p&gt;Find the library on npmjs here.&lt;/p&gt;

&lt;p&gt;Feel free to contribute and raise issues/feature tickets on GitHub.&lt;/p&gt;

</description>
      <category>expo</category>
      <category>reactnative</category>
      <category>opensource</category>
      <category>android</category>
    </item>
    <item>
      <title>Read OTP SMS- Expo / React Native (Android)</title>
      <dc:creator>Abhishek Jain</dc:creator>
      <pubDate>Tue, 14 Mar 2023 07:54:01 +0000</pubDate>
      <link>https://dev.to/maniactech/read-otp-sms-expo-react-native-android-73n</link>
      <guid>https://dev.to/maniactech/read-otp-sms-expo-react-native-android-73n</guid>
      <description>&lt;p&gt;OTP (One Time Password) is a kind of passwordless authentication, which enables user identity verification, granting access to an app/website without the need to remember passwords.&lt;/p&gt;

&lt;p&gt;As of now reading incoming OTP SMS on native Android applications is available out of the box, that is not the case for applications developed in Expo targeting Android platform.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Our focus with this article is strictly to reading incoming OTP SMS in Expo on Android.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;@maniac-tech/react-native-expo-read-sms has been developed to resolve this very limitation on Expo on Android.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Read incoming OTP SMS:
&lt;/h2&gt;

&lt;p&gt;We will make use of &lt;a href="https://maniac-tech.com/expo-read-sms/" rel="noopener noreferrer"&gt;@maniac-tech/react-native-expo-read-sms&lt;/a&gt; to read incoming SMS in apps built using Expo on Android. These SMS will then be matched with our regex to derive the OTP value if any. You can find the sample app repo mentioned at the end of the article.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Code
&lt;/h3&gt;

&lt;p&gt;Step 1. Import the library with the following functions into your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    import {

     checkIfHasSMSPermission,

     requestReadSMSPermission,

     startReadSMS,

    } from “@maniac-tech/react-native-expo-read-sms”;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2. Check if the app has required SMS Permissions (READ_SMS, RECEIVE_SMS):&lt;br&gt;
&lt;code&gt;const permissionState = await checkIfHasSMSPermission();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The return value of &lt;em&gt;checkIfHasSMSPermission&lt;/em&gt; is either false (when permissions are not present), or an object (when permissions are present)&lt;/p&gt;

&lt;p&gt;Step 3. Considering that the initial value of the permission will be false, we need to request for user permission:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;requestReadSMSPermission();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This function will show the native UI seeking SMS Permissions, like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0l99wwagezz8b9ew9wza.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0l99wwagezz8b9ew9wza.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Once the user has allowed the permissions, we can start listening to incoming SMS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;startReadSMS(successCallbackFn, errorCallbackFn)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As per the documentation of the library:&lt;/p&gt;

&lt;p&gt;The function startReadSMS, accepts two parameters a success &amp;amp; a error callback.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const successCallbackFn( status, sms, error) {

    if (status === “success”) {

    console.log(“Success in success callback”);

    // Run a regex of your OTP Message and process it as per your application logic

    if (OTPRegex.test(sms)){

    // OTP matched

    }

    } else {

    console.log(“Error in success callback”);

    console.log(error);

    }

    }

    const errorCallbackFn = (status, sms, error) =&amp;gt; {

    console.log(“Error Callback!”);

    console.log(“Start Read SMS failed”);

    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Voila!! We can now read incoming OTP SMS in Expo on Android !!&lt;/p&gt;

&lt;p&gt;You can find the sample app using the library on GitHub here.&lt;/p&gt;

&lt;p&gt;Find the library on npmjs here.&lt;/p&gt;

&lt;p&gt;Feel free to contribute and raise issues/feature tickets on GitHub.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>opensource</category>
      <category>android</category>
      <category>readsms</category>
    </item>
  </channel>
</rss>
