<?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: Shadman</title>
    <description>The latest articles on DEV Community by Shadman (@shadman45503145).</description>
    <link>https://dev.to/shadman45503145</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%2F227099%2Fac437a98-0296-4b00-919c-66c2c0f99bcc.jpg</url>
      <title>DEV Community: Shadman</title>
      <link>https://dev.to/shadman45503145</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shadman45503145"/>
    <language>en</language>
    <item>
      <title>BarCode and QR Code Scanning in React Native Apps</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sun, 29 Mar 2020 21:55:06 +0000</pubDate>
      <link>https://dev.to/enappd/barcode-and-qr-code-scanning-in-react-native-apps-o7</link>
      <guid>https://dev.to/enappd/barcode-and-qr-code-scanning-in-react-native-apps-o7</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post is all about implementing the QR Code Scanner in your cool new react-native application. In this post, you will learn&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;QRCode Scanner&lt;/code&gt; in our app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to read data from the QR Code in React-Native app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to open a link in the browser after successfully reading data from the QR Code.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Before start, first you will need a React-Native app to start with, hence you can follow &lt;a href="https://facebook.github.io/react-native/docs/getting-started" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create a react-native app for beginners&lt;/strong&gt; &lt;/a&gt;and start after that from here.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/enappd/RNQRCodeScanning" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;RNQRCodeScanning&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What is React-Native&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML-Esque markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; web views, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this tutorial, we’ll cover QR Code implementation. The vast majority of the code we write will be cross-platform. And yes: you can use React Native to build production-ready mobile applications! Some anecdota: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;br&gt; The fact that React Native actually renders using its host platform’s standard rendering APIs enables it to stand out from most existing methods of cross-platform application development, like Cordova or Ionic.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Existing methods of writing mobile applications using combinations of JavaScript, HTML, and CSS typically render using web views. While this approach can work, it also comes with drawbacks, especially around performance. Additionally, they do not usually have access to the host platform’s set of native UI elements. When these frameworks do try to mimic native UI elements, the results usually “feel” just a little off; reverse-engineering all the fine details of things like animations takes an enormous amount of effort, and they can quickly become out of date.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What and why QR Code?&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--NEi-PX1V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Alyvi6CJEM3hVaHa9dIyJ2w.gif"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;QR code&lt;/strong&gt; (abbreviated from &lt;strong class="markup--strong markup--p-strong"&gt;Quick Response Code&lt;/strong&gt;) is the trademark for a type of &lt;a href="https://en.wikipedia.org/wiki/Matrix_barcode" class="markup--anchor markup--p-anchor" title="Matrix barcode" rel="noopener"&gt;matrix barcode&lt;/a&gt; (or two-dimensional &lt;a href="https://en.wikipedia.org/wiki/Barcode" class="markup--anchor markup--p-anchor" title="Barcode" rel="noopener"&gt;barcode&lt;/a&gt;) first designed in 1994 for the &lt;a href="https://en.wikipedia.org/wiki/Automotive_industry_in_Japan" class="markup--anchor markup--p-anchor" title="Automotive industry in Japan" rel="noopener"&gt;automotive industry in Japan&lt;/a&gt;. A barcode is a machine-readable optical label that contains information about the item to which it is attached. In practice, QR codes often contain data for a &lt;a href="https://en.wikipedia.org/wiki/URL" class="markup--anchor markup--p-anchor" title="URL" rel="noopener"&gt;locator&lt;/a&gt;, identifier, or &lt;a href="https://en.wikipedia.org/wiki/Website_visitor_tracking" class="markup--anchor markup--p-anchor" title="Website visitor tracking" rel="noopener"&gt;tracker&lt;/a&gt; that points to a website or application. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and &lt;a href="https://en.wikipedia.org/wiki/Kanji" class="markup--anchor markup--p-anchor" title="Kanji" rel="noopener"&gt;kanji&lt;/a&gt;) to store data efficiently; extensions may also be used.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;QR code scanning is something almost every smartphone user has done at least once. We scan QR codes in supermarkets, on products in general, and oh, Amazon delivery! It’s a very handy way to recognize products instead of entering 16 digit long ID numbers etc. Similarly, reading ID numbers from Passports, etc could be very handy if you are an international hotel owner and require guests to carry passports as IDs. Or maybe you want to read off a vehicle registration number using your phone.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here are some potential use cases for these plugins in React-Native app&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Online Payment apps — QR scanners can provide product info to users and paying the facility.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Delivery app — QR Code scan can track/sign off a package and you can pay them by scanning QR Code&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Quick access to offers — Scan QR codes and go to a webpage&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Web authentication of a mobile app — Similar to Whatsapp Web&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Event app — Scan tickets or events passes&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;…… and many more&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;All this can now be done in React-Native apps, with the latest open source &lt;a href="https://github.com/moaazsidat/react-native-qrcode-scanner" class="markup--anchor markup--p-anchor" rel="noopener"&gt;react-native-qrcode-scanner&lt;/a&gt; npm package available in React-Native. In this article, we will focus on such implementation. So here are some of the scan plugins and functionalities you can implement with React-native.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;react-native-qrcode-scanner&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;react-native-scan-view&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://github.com/react-native-community/react-native-camera" class="markup--anchor markup--li-anchor" rel="nofollow noreferrer noopener noopener noopener noopener"&gt;react-native-camera&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;….and many more.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--3oQXOYeZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AeH7cIE-7QCNrJTBheLvKVw.gif"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1:- &lt;/strong&gt;Install the react-native-camera plugin by executing this command&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add react-native-camera@git+&lt;a href="https://git@github.com/react-native-community/react-native-camera.git"&gt;https://git@github.com/react-native-community/react-native-camera.git&lt;/a&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here &lt;a href="https://github.com/lwansbrough/react-native-camera" class="markup--anchor markup--p-anchor" rel="noopener"&gt;react-native-camera&lt;/a&gt; is a dependency for this package so you will need to add it in your project.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2:- &lt;/strong&gt;Install the QR Scanner plugin by executing this command&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add &lt;code class="markup--code markup--pre-code"&gt;react-native-qrcode-scanner&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now, to use react-native-qrcode-scanner, &lt;code class="markup--code markup--p-code"&gt;import&lt;/code&gt; the &lt;code class="markup--code markup--p-code"&gt;react-native-qrcode-scanner&lt;/code&gt; module and use the &lt;code class="markup--code markup--p-code"&gt;&amp;lt;QRCodeScanner /&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here, we are working on &lt;strong class="markup--strong markup--p-strong"&gt;react-native version 0.60.5&lt;/strong&gt;. Hence we don’t need to link any package externally as in the latest versions above 0.60 react-native provides &lt;strong class="markup--strong markup--p-strong"&gt;auto-linking functionality&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Add Button to scan a QRCode and to get the result&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now you are ready to use the QR Code Scanner function provided by the React-Native &lt;code class="markup--code markup--p-code"&gt;react-native-qrcode-scanner&lt;/code&gt; package and get the result. Before this let us make a beautiful view to access the QRCode function by clicking a button and getting the data in response.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
QR Code view
&lt;p class="graf graf--p graf-after--figure"&gt;The Result for the above code is:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--9VwNCZEa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A9QHqR3N08MzJTo1AeAs6aw.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;As we have completed our UI for beautiful interaction, you can simply use the below function to complete a QR Code scan process.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Complete UI and Logic of the application —&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
Complete logic and view
&lt;p class="graf graf--p graf-after--figure"&gt;In this tutorial, we have used react-native default Linking property to open the external URL in the browser only when we get a URL after a successful scan. If the result contains a URL then it will navigate to that web page or if it does not contain any URL then it will print the result in both cases.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;onSuccess = (e) =&amp;gt; {&lt;br&gt;const check = e.data.substring(0, 4);&lt;br&gt;console.log('scanned data' + check);&lt;br&gt;this.setState({&lt;br&gt;result: e,&lt;br&gt;scan: false,&lt;br&gt;ScanResult: true&lt;br&gt;})&lt;br&gt;if (check === 'http') &lt;br&gt;{&lt;br&gt;Linking&lt;br&gt;.openURL(e.data)&lt;br&gt;.catch(err =&amp;gt; console.error('An error occured', err));&lt;br&gt;} else {&lt;br&gt;this.setState({&lt;br&gt;result: e,&lt;br&gt;scan: false,&lt;br&gt;ScanResult: true})}}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;On clicking the “&lt;strong class="markup--strong markup--p-strong"&gt;Click to Scan&lt;/strong&gt;” button it will initiate the hardware camera and a pop up will appear for camera permission. To set the camera permission you would need to add the following code to the &lt;code class="markup--code markup--p-code"&gt;AndroidManifest.xml&lt;/code&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&amp;lt;uses-permission android:name="android.permission.CAMERA" /&amp;gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;By adding this line in your &lt;code class="markup--code markup--p-code"&gt;AndroidManifest.xml&lt;/code&gt; you are all set to use camera feature in your application to scan a QR Code. &lt;br&gt;Let’s scan some QR Codes…&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--m3LF2ry5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A0eRYArds_HhztParw5eEGw.jpeg"&gt;&lt;br&gt;Camera open to scan a QR Code&lt;p class="graf graf--p graf-after--figure"&gt;If you are scanning a webpage QR code then on successful scan it will return a URL and in this tutorial we have written a function for that, if it does contain a URL then it will print the result and navigate to the web page in the browser and if it is not an encoded web page QR Code then it will simply print the result and you will see a button below the result to scan another QR Code.&lt;br&gt;Here in the scanning view, you can see we have two buttons at the bottom of the app which are —&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ok. Got it&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Stop Scan&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Here in the first case, it will call the reactivate() function where this will reactivate the scanning ability of the component. And in the second case, it will just close the camera and navigate back to the home page.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Let’s check the results —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vj2Bf8U4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Aj4nTzBe0wj-FAcCA5IuCdg.jpeg"&gt;&lt;br&gt;Contains a URL&lt;p class="graf graf--p graf-after--figure"&gt;This will open the scanned webpage in the browser.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--iPJoSgMf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Ag9aH3I-RKwpAKBejl-xRew.jpeg"&gt;&lt;br&gt;QR_CODE Result&lt;p class="graf graf--p graf-after--figure"&gt;There are some methods that you can use to get features according to your requirement —&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;reactivate()&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Call this method to programmatically enabling scanning again. Use this by attaching a &lt;code class="markup--code markup--p-code"&gt;ref&lt;/code&gt; like so &lt;code class="markup--code markup--p-code"&gt;&amp;lt;QRCodeScanner ref={(node) =&amp;gt; { this.scanner = node }}&amp;gt;&lt;/code&gt; and calling &lt;code class="markup--code markup--p-code"&gt;this.scanner.reactivate()&lt;/code&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Props&lt;/h3&gt;
&lt;h4 class="graf graf--h4 graf-after--h3"&gt;
&lt;code class="markup--code markup--h4-code"&gt;onRead&lt;/code&gt; (required)&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;func.isRequired&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;(e) =&amp;gt; (console.log('QR code scanned!', e))&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Will call this specified method when a QR code or a barcode is detected in the camera’s view passing in the event emitted upon reading the code.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;fadeIn&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;bool&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;true&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When set to &lt;code class="markup--code markup--p-code"&gt;true&lt;/code&gt; this ensures that the camera view fades in after the initial load up instead of being rendered immediately. Set this to false to prevent the animated fade in of the camera view.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;reactivate&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;bool&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;false&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When set to &lt;code class="markup--code markup--p-code"&gt;false&lt;/code&gt;, when a QR code is scanned, the &lt;code class="markup--code markup--p-code"&gt;QRCodeScanner&lt;/code&gt; will not scan another code until it is re-rendered. When set to &lt;code class="markup--code markup--p-code"&gt;true&lt;/code&gt; this will reactivate the scanning ability of the component.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;reactivateTimeout&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;number&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;0&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to configure how long it should take before the &lt;code class="markup--code markup--p-code"&gt;QRCodeScanner&lt;/code&gt; should reactivate.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;topContent&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;oneOfType([ PropTypes.element, PropTypes.string, ])&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to render any additional content at the top of the camera view.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;bottomContent&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;oneOfType([ PropTypes.element, PropTypes.string, ])&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to render any additional content at the bottom of the camera view.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;containerStyle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to pass styling for the outermost container. Useful for adding margin/padding to account for navigation bar.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;cameraStyle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to pass or overwrite styling for the camera window rendered.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;topViewStyle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to pass or overwrite styling for the &lt;code class="markup--code markup--p-code"&gt;&amp;lt;View&amp;gt;&lt;/code&gt; that contains the &lt;code class="markup--code markup--p-code"&gt;topContent&lt;/code&gt; prop.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;bottomViewStyle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to pass or overwrite styling for the &lt;code class="markup--code markup--p-code"&gt;&amp;lt;View&amp;gt;&lt;/code&gt; that contains the &lt;code class="markup--code markup--p-code"&gt;bottomContent&lt;/code&gt; prop.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;showMarker&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;boolean&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;false&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to show marker on the camera scanning window.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;customMarker&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;element&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Pass a RN element/component to use it as a custom marker.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;markerStyle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;any&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to add custom styling to the default marker.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;notAuthorizedView&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;element&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Pass a RN element/component to use it when no permissions given to the camera (iOS only).&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;cameraType&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;oneOf(['front', 'back'])&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;'back'&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to control which camera to use for scanning QR codes, defaults to rear camera.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;checkAndroid6Permissions&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;bool&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;false&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to enable permission checking on Android 6&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;permissionDialogTitle&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;string&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;'Info'&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to setting permission dialog title (Android only).&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;permissionDialogMessage&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;string&lt;/code&gt; default: &lt;code class="markup--code markup--p-code"&gt;'Need camera permission'&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Use this to setting permission dialog message (Android only).&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;code class="markup--code markup--h4-code"&gt;cameraProps&lt;/code&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;propType: &lt;code class="markup--code markup--p-code"&gt;object&lt;br&gt;&lt;/code&gt;Properties to be passed to the &lt;code class="markup--code markup--p-code"&gt;Camera&lt;/code&gt; component.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Using this npm package you can scan a Barcode too. I have not tried that in here but why don’t you give it a try and tell me in the comment section below.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here in the tutorial, successfully implemented the plugin and got the perfect result. &lt;a href="https://github.com/enappd/RNQRCodeScanning" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;You can follow all the steps and achieve this very easily or you can clone my repo on Github for both the plugins here and enjoy 😎 😎 😎 🕺 🕺 🕺..…&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to integrate the QR Code scanner and use it in React-Native applications. Since the plugin is amazingly light and have great documentation, it is the developers’ first choice when it comes to creating QR code.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/enappd/RNQRCodeScanning" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;RNQRCodeScanning&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 is-selected"&gt;Now that you have learned the implementation of react-native-qrcode-scanner in React-Native, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>qrcode</category>
      <category>barcode</category>
      <category>scanner</category>
    </item>
    <item>
      <title>Send, Read and Delete SMS in React Native</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sun, 29 Mar 2020 17:06:38 +0000</pubDate>
      <link>https://dev.to/enappd/send-read-and-delete-sms-in-react-native-23oa</link>
      <guid>https://dev.to/enappd/send-read-and-delete-sms-in-react-native-23oa</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure is-selected"&gt;In this tutorial, we are going to implement send, read and delete SMS actions from your mobile device using react-native application. Using these implementations you can send message to someone, you can read particular persons or profiles message by clicking a single button and you can delete a particular message too from your device by implementing some cool functions using react-native-sms and react-native-get-sms-android in our cool react-native application.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;a href="https://github.com/mdshadman/React_Native_Send_Get_Delete_SMS" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial can be found at &lt;/em&gt;React_Native_Send_Get_Delete_SMS&lt;/strong&gt;&lt;/a&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;In this tutorial, we will focus on some basic and major parts where many expert developers or juvenile beginners get confused. Hence we will check each and everything in step-by-step as: —&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;What and why React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to create react native app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;What and Why react-native-sms and react-native-get-sms&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Setup and Implementation&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Working example&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Step 1: — What and why React Native?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML-Esque markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this tutorial, we’ll cover firebase phone authentication and CRUD operations. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some anecdota: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopeneer noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopeneer noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopeneer noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;br&gt;The fact that React Native actually renders using its host platform’s standard rendering APIs enables it to stand out from most existing methods of cross-platform application development, like Cordova or Ionic.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Existing methods of writing mobile applications using combinations of JavaScript, HTML, and CSS typically render using webviews. While this approach can work, it also comes with drawbacks, especially around performance. Additionally, they do not usually have access to the host platform’s set of native UI elements. When these frameworks do try to mimic native UI elements, the results usually “feel” just a little off; reverse-engineering all the fine details of things like animations takes an enormous amount of effort, and they can quickly become out of date.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;step 2: — How to create react native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Keeping in mind everyone I am going to explain about the creation of a new cool react-native project. First, of all, I would like to inform you that the latest react native version at present when I am writing this blog is 0.60.5. And above 0.60 react-native gave us a very convenient and easy facility which is above this version we do not need to run react-native link anymore. Above this version, we get the auto-linking facility in the app for packages.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The first step to create a new project is installing react-native CLI if already not present in your device. By executing this command in terminal&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install -g react-native-cli&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;After successful CLI installation execute the command&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;react-native init yourProjectNameHere&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;a href="https://facebook.github.io/react-native/docs/getting-started" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;For further steps as android studio setup and SDK installation or environment setpup please follow this link…Click here.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now you are all set for boom 🧨 🧨 🧨 boom 🧨 🧨 🧨 🧨…..&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;step 3: — What and Why react-native-sms and react-native-get-sms?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Let us make you understand why we need to use react-native-sms and react-native-get-sms. I will try to make you understand in my language as if you are getting irritated with some unwanted service provider’s message or with any one’s message then, in that case, you can just pass that one person or organizations particular id and delete their messages on a single click like the same you can send someone, in particular, a text message from your app by clicking a single button or this is not the last thing you can achieve with this tutorial, you can also read any particular message in your app from your inbox.mail, chat, etc.&lt;br&gt;Here in this tutorial I have integrated and successfully achieved these awesome facilities but you can explore it more and implement much more things according to your need. Hence let’s go and see how we can implement these in very few easy steps.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 4: — Setup and Implementation&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First of all, install the dependencies by executing this command: —&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm i react-native-sms&lt;br&gt;Then,&lt;br&gt;npm i react-native-get-sms-android&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You can only install the second npm package and implement all functionalities but I have used react-native-sms to send sms and react-native-get-sms-android to read and delete sms.&lt;br&gt;Now we need to give some permissions to the application as: —&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Android Permissions&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Add permissions to your &lt;code class="markup--code markup--p-code"&gt;android/app/src/main/AndroidManifest.xml&lt;/code&gt; file.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;...&lt;br&gt;&amp;lt;uses-permission android:name="android.permission.READ_SMS" /&amp;gt;&lt;br&gt;&amp;lt;uses-permission android:name="android.permission.WRITE_SMS" /&amp;gt;&lt;br&gt;&amp;lt;uses-permission android:name="android.permission.SEND_SMS" /&amp;gt;&lt;br&gt;...&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;then,&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In MainActivity.java &lt;em class="markup--em markup--p-em"&gt;copy and paste these on their defined places&lt;/em&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import com.react.SmsPackage;&lt;br&gt;import com.tkporter.sendsms.SendSMSPackage;&lt;br&gt;&lt;a href="http://twitter.com/Override" class="markup--anchor markup--pre-anchor" title="Twitter profile for @Override"&gt;@Override&lt;/a&gt;&lt;br&gt;public void onActivityResult(int requestCode, int resultCode, Intent data)&lt;br&gt;{&lt;br&gt;super.onActivityResult(requestCode, resultCode, data);&lt;br&gt;//probably some other stuff here&lt;br&gt;SendSMSPackage.getInstance().onActivityResult(requestCode, resultCode, data);&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;And in &lt;em class="markup--em markup--p-em"&gt;MainApplication.java import these lines&lt;/em&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import com.tkporter.sendsms.SendSMSPackage;&lt;br&gt;import com.react.SmsPackage;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;For common issues, you can visit these links.&lt;br&gt;1. &lt;a href="https://www.npmjs.com/package/react-native-get-sms-android" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;/a&gt;&lt;a href="https://www.npmjs.com/package/react-native-get-sms-android"&gt;https://www.npmjs.com/package/react-native-get-sms-android&lt;/a&gt;&lt;br&gt;2. &lt;a href="https://www.npmjs.com/package/react-native-sms" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;/a&gt;&lt;a href="https://www.npmjs.com/package/react-native-sms"&gt;https://www.npmjs.com/package/react-native-sms&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We are all set to achieve the final result but before that let us make some interactive UI for the application.&lt;br&gt;View Logics: —&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;View Result Is: —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--XCNXBupf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AFseQEhzGIBCpLgCAQ2RdUQ.jpeg"&gt;&lt;br&gt;Click for actions&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--_pXUm-Lh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AeVUpwGFbhqbuxPTKMFru1g.jpeg"&gt;&lt;br&gt;Permissions required&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--lMHFuYZp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHT5HmbWPYzfw4E0j0VJdQw.jpeg"&gt;&lt;br&gt;Reading data of particular Id&lt;p class="graf graf--p graf-after--figure"&gt;We have three buttons on the card as:-&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Send SMS → Click to send SMS to a particular contact.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Read SMS → Click to read the message by passing the id of the message.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Delete SMS → Click to delete an SMS by passing the id of the message.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now let's implement the logic part: —&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
Complete logic for Send, Read and Delete SMS
&lt;p class="graf graf--p graf-after--figure"&gt;Here we have different options to set as actions during reading an SMS as:-&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;var filter = {&lt;br&gt;box: 'inbox', // 'inbox' (default), 'sent', 'draft', 'outbox', 'failed', 'queued', and '' for all&lt;br&gt;// the next 4 filters should NOT be used together, they are OR-ed so pick one&lt;br&gt;read: 0, // 0 for unread SMS, 1 for SMS already read&lt;br&gt;_id: 1234, // specify the msg id&lt;br&gt;address: '+1888------', // sender's phone number&lt;br&gt;body: 'How are you', // content to match&lt;br&gt;// the next 2 filters can be used for pagination&lt;br&gt;indexFrom: 0, // start from index 0&lt;br&gt;maxCount: 10, // count of SMS to return each time&lt;br&gt;};&lt;br&gt;/&lt;em&gt;&lt;br&gt;Each sms will be represents by a JSON object represented below&lt;br&gt;{&lt;br&gt;"_id": 1234,&lt;br&gt;"thread_id": 3,&lt;br&gt;"address": "2900",&lt;br&gt;"person": -1,&lt;br&gt;"date": 1365053816196,&lt;br&gt;"date_sent": 0,&lt;br&gt;"protocol": 0,&lt;br&gt;"read": 1,&lt;br&gt;"status": -1,&lt;br&gt;"type": 1,&lt;br&gt;"body": "Hello There, I am an SMS",&lt;br&gt;"service_center": "+60162999922",&lt;br&gt;"locked": 0,&lt;br&gt;"error_code": -1,&lt;br&gt;"sub_id": -1,&lt;br&gt;"seen": 1,&lt;br&gt;"deletable": 0,&lt;br&gt;"sim_slot": 0,&lt;br&gt;"hidden": 0,&lt;br&gt;"app_id": 0,&lt;br&gt;"msg_id": 0,&lt;br&gt;"reserved": 0,&lt;br&gt;"pri": 0,&lt;br&gt;"teleservice_id": 0,&lt;br&gt;"svc_cmd": 0,&lt;br&gt;"roam_pending": 0,&lt;br&gt;"spam_report": 0,&lt;br&gt;"secret_mode": 0,&lt;br&gt;"safe_message": 0,&lt;br&gt;"favorite": 0&lt;br&gt;}&lt;br&gt;&lt;/em&gt;/&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now if you have followed each step and completed all the phases then you are all set to check out the output or you can just clone the repo and start from there.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;a href="https://github.com/mdshadman/React_Native_Send_Get_Delete_SMS" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Complete source code of this tutorial can be found at &lt;/em&gt;React_Native_Send_Get_Delete_SMS&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this blog, you learned how to send read and delete an SMS from your device in the React Native apps for Android. You also learned how to integrate react-native-sms and react-native-get-sms in the react-native application. We also built the app in Android and ran on a device.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned how to send read and delete an SMS from your device in React Native apps for Android, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ukxSVA_j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2An0EmkGqdrCykIp3T.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>sms</category>
    </item>
    <item>
      <title>How to translate in React Native app- Globalization, Internationalization, and Text to Speech</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sun, 29 Mar 2020 15:27:22 +0000</pubDate>
      <link>https://dev.to/enappd/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech-57b3</link>
      <guid>https://dev.to/enappd/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech-57b3</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post is all about implementing the multi-language translation and text to speech in your cool new react-native application. In this post, you will learn&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;react-native-tts &lt;/code&gt;in our app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to use &lt;code class="markup--code markup--li-code"&gt;i18n-js&lt;/code&gt; in your app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;react-native-localization &lt;/code&gt;in our app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Before start, first you will need a React-Native app to start with, hence you can follow &lt;a href="https://facebook.github.io/react-native/docs/getting-started" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create a react-native app for beginners&lt;/strong&gt; &lt;/a&gt;and start after that from here.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/RNInternationalizatio-TextToSpeech" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;RNInternationalizatio-TextToSpeech&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What is React-Native&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3 is-selected"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML-Esque markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; web views, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this tutorial, we’ll cover translation and text to speech implementation. The vast majority of the code we write will be cross-platform. And yes: you can use React Native to build production-ready mobile applications! Some anecdota: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;br&gt; The fact that React Native actually renders using its host platform’s standard rendering APIs enables it to stand out from most existing methods of cross-platform application development, like Cordova or Ionic.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Existing methods of writing mobile applications using combinations of JavaScript, HTML, and CSS typically render using web views. While this approach can work, it also comes with drawbacks, especially around performance. Additionally, they do not usually have access to the host platform’s set of native UI elements. When these frameworks do try to mimic native UI elements, the results usually “feel” just a little off; reverse-engineering all the fine details of things like animations takes an enormous amount of effort, and they can quickly become out of date.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What and why Internationalization and Text to speech?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Internationalization in React Native&lt;/strong&gt;. &lt;strong class="markup--strong markup--p-strong"&gt;Internationalization&lt;/strong&gt; (&lt;strong class="markup--strong markup--p-strong"&gt;i18n&lt;/strong&gt; for short) is the process of adapting an application to work with different languages and regions.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;i18n&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;In computing, there’s a common term used when discussing localization &amp;amp; internationalization called &lt;strong class="markup--strong markup--p-strong"&gt;i18n &lt;/strong&gt;which is basically the first and last letters in the word &lt;strong class="markup--strong markup--p-strong"&gt;i&lt;/strong&gt;nternationalizatio&lt;strong class="markup--strong markup--p-strong"&gt;n &lt;/strong&gt;and the 18 characters between them (thanks &lt;a href="https://en.wikipedia.org/wiki/Internationalization_and_localization" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Wikipedia&lt;/a&gt; for that).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Multi-language translation OR internationalization-localization is a growing need for every app that wants to target international customers. Till date, the majority of apps have been developed in English, no surprise! In this blog post, we will learn how to implement translation, OR technically — Internationalization + Localization in Ionic 4 apps.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;First, we need to understand the steps involved in the process. Translations, thanks to Google, look very easy, but they are a bit involved in the case of apps and websites, in our case Ionic 4 apps. There are 3 major steps in the translation process in an app —&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Translation Language&lt;/strong&gt; — Detect the language you want to translate into. This can either be done automatically by detecting phone or browser’s language OR, can be done with user actions (say, by using a dropdown).For our use case, we will detect the device’s language using &lt;a href="https://www.npmjs.com/package/react-native-localization" class="markup--anchor markup--li-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;react-native-localization.&lt;/strong&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Prepare Language Text&lt;/strong&gt; — You need to have a pre-translated dictionary (or JSON file) that stores the translations of all your app’s text in the Translation language. There are several ways to do this, as we’ll see in the following steps. This is mostly a manual process for smaller apps, but you can use online tools like &lt;a href="https://www.logisticinfotech.com/translate-language-files-online-json/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;this&lt;/a&gt; for quick translations, or like &lt;a href="https://poeditor.com/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;POEditor&lt;/a&gt; for more standardized workflow.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Translate&lt;/strong&gt; — After the above two steps, you actually translate your app’s text to the Translation language text. We will use the &lt;a href="https://github.com/fnando/i18n-js" class="markup--anchor markup--li-anchor" rel="noopener"&gt;i18n-js&lt;/a&gt; library for translating our texts.&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Till now we got to know about our implementations and the basic idea of our need. Hence we will achieve the above target by following it step by step.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;STEP 1: Prepare language JSON files&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will create these JSON files in &lt;code class="markup--code markup--p-code"&gt;android/app/src/main/assets/translations&lt;/code&gt; folder. The &lt;code class="markup--code markup--p-code"&gt;assets&lt;/code&gt; folder remains in the root even after a production builds, so the path does not break. I have created multiple JSON files &lt;code class="markup--code markup--p-code"&gt;en.json&lt;/code&gt; (English), &lt;code class="markup--code markup--p-code"&gt;fr.json&lt;/code&gt; (French),&lt;code class="markup--code markup--p-code"&gt;es.json&lt;/code&gt; (Spanish),&lt;code class="markup--code markup--p-code"&gt;ar.json&lt;/code&gt; (Arabic),&lt;code class="markup--code markup--p-code"&gt;it.json&lt;/code&gt; (Italian),&lt;code class="markup--code markup--p-code"&gt;hi.json&lt;/code&gt; (Hindi),&lt;code class="markup--code markup--p-code"&gt;ru.json&lt;/code&gt; (Russian) and many more.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Folder structure for i18n files are like below&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;en.json&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;{&lt;br&gt;"hello": "Hello shadman! Welcome to localizationa nd internationalization tutorial. Hope you enjoyed the tutorial and implemented it in your app."&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The &lt;code class="markup--code markup--p-code"&gt;&lt;code&gt;{{value}}&lt;/code&gt;&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;&lt;code&gt;{{name_value}}&lt;/code&gt;&lt;/code&gt; are kind of variable/constants we can pass from our component. This can be used to keep a word constant across translations OR to give translations not supported by the library.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;STEP 2: Implement libraries&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We’ll start by adding an internationalization module to our React Native project called &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://github.com/AlexanderZaytsev/react-native-i18n" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;react-native-i18n&lt;/strong&gt;&lt;/a&gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm i react-native-i18n --save&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now install the npm package &lt;strong class="markup--strong markup--p-strong"&gt;react-native-localization&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm i react-native-localization&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now install the npm package &lt;strong class="markup--strong markup--p-strong"&gt;react-native-tts &lt;/strong&gt;for text to speech&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm i react-native-tts&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;We will implement both internationalization and text to speech together in our app but step by step.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here, we are working on &lt;strong class="markup--strong markup--p-strong"&gt;react-native version 0.60.5&lt;/strong&gt;. Hence we don’t need to link any package externally as in the latest versions above 0.60 react-native provides &lt;strong class="markup--strong markup--p-strong"&gt;auto-linking functionality&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Add Interactive UI to Translate and text to speech&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now you are ready to use the localization and text to speech function provided by the React-Native &lt;code class="markup--code markup--p-code"&gt;react-native-tts and react-native-localization &lt;/code&gt;package and get the result. Before this let us make a beautiful view to access these functions by clicking a button and getting the data in response.&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;The Result for the above code is:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--7KG3-hbg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AUwY3qIvRS7pljGWsTD9-Tw.png"&gt;&lt;br&gt;Select your language&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--aTsO8xG6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Aw17NE_9vCajG9_via5lUaA.png"&gt;&lt;br&gt;Check translation&lt;p class="graf graf--p graf-after--figure"&gt;As we have completed our UI for beautiful interaction, you can simply use the below function to complete translation and text to speech process.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Complete Logic of the application: —&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
Logics for Translation and Text-to-Speech
&lt;p class="graf graf--p graf-after--figure"&gt;In the above gist, I have used a function “I18n.t()&lt;strong class="markup--strong markup--p-strong"&gt;” &lt;/strong&gt;to translate our texts in different languages.&lt;br&gt;This plugin obtains information and performs operations specific to the user’s locale, language, and timezone. Note the difference between locale and language: locale controls how numbers, dates, and times are displayed for a region, while language determines what language text appears as, independently of locale settings. Often developers use locale to set both settings, but there is no reason a user couldn’t set her language to “English” but locale to “French”, so that text is displayed in English but dates, times, etc., are displayed as they are in France. Unfortunately, most mobile platforms currently do not make a distinction between these settings.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In the above example, I have called some events in the constructor to load default values like start, cancel, finish, speech rate to control these actions.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.addEventListener("tts-start", event =&amp;gt;&lt;br&gt;this.setState({ ttsStatus: "started" })&lt;br&gt;);&lt;br&gt;Tts.addEventListener("tts-finish", event =&amp;gt;&lt;br&gt;this.setState({ ttsStatus: "finished" })&lt;br&gt;);&lt;br&gt;Tts.addEventListener("tts-cancel", event =&amp;gt;&lt;br&gt;this.setState({ ttsStatus: "cancelled" })&lt;br&gt;);&lt;br&gt;Tts.setDefaultRate(this.state.speechRate);&lt;br&gt;Tts.setDefaultPitch(this.state.speechPitch);&lt;br&gt;Tts.getInitStatus().then(this.initTts);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;After this, we have called initTts function.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;initTts = async () =&amp;gt; {&lt;br&gt;const voices = await Tts.voices();&lt;br&gt;const availableVoices = voices&lt;br&gt;.filter(v =&amp;gt; !v.networkConnectionRequired &amp;amp;&amp;amp; !v.notInstalled)&lt;br&gt;.map(v =&amp;gt; {&lt;br&gt;return { id: v.id, name: v.name, language: v.language };&lt;br&gt;});&lt;br&gt;let selectedVoice = null;&lt;br&gt;if (voices &amp;amp;&amp;amp; voices.length &amp;gt; 0) {&lt;br&gt;selectedVoice = voices[4].id;&lt;br&gt;try {&lt;br&gt;await Tts.setDefaultLanguage(voices[0].language);&lt;br&gt;} catch (err) {&lt;br&gt;// My Samsung S9 has always this error: "Language is not supported"&lt;br&gt;console.log(&lt;code&gt;setDefaultLanguage error&lt;/code&gt;, err);&lt;br&gt;}&lt;br&gt;await Tts.setDefaultVoice(voices[0].id);&lt;br&gt;this.setState({&lt;br&gt;voices: availableVoices,&lt;br&gt;selectedVoice,&lt;br&gt;ttsStatus: "initialized"&lt;br&gt;});&lt;br&gt;} else {&lt;br&gt;this.setState({ ttsStatus: "initialized" });&lt;br&gt;}&lt;br&gt;};&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;We have used this function to filter available languages and voices.&lt;br&gt;After executing these functions we can achieve our requirement. The code view and output of the above function in my app are as: —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--WFqJ0C0b--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AxL4gDZNJdjqDxoBNG429PA.png"&gt;&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--k0LB3idd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Aa-ibZv9paZhko7fufeKAJQ.png"&gt;&lt;br&gt;Text To speech View&lt;p class="graf graf--p graf-after--figure"&gt;In the above image, you can type any thing in the text input field and click on the Start reading Text button to listen to the text invoice.&lt;br&gt;A list of available voices is on the list which you can select for speech either for male or female.&lt;br&gt;&lt;strong class="markup--strong markup--p-strong"&gt;To Install (additional) language data&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Shows the Android Activity to install additional language/voice data.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.requestInstallData();&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;There are some methods that you can use to get features according to your requirement —&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Speaking&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Add utterance to the TTS queue and start speaking. Returns promise with utteranceId.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.speak('Hello, world!');&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Additionally, speak() allows to pass platform-specific options ‘voiceId’ on IOS and ‘params’ on Android to underlying platform API:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.speak('Hello, world!', { iosVoiceId&lt;strong class="markup--strong markup--pre-strong"&gt;:&lt;/strong&gt; 'com.apple.ttsbundle.Moira-compact' });&lt;br&gt;Tts.speak('Hello, world!', { androidParams&lt;strong class="markup--strong markup--pre-strong"&gt;:&lt;/strong&gt; { KEY_PARAM_PAN&lt;strong class="markup--strong markup--pre-strong"&gt;:&lt;/strong&gt; &lt;strong class="markup--strong markup--pre-strong"&gt;-&lt;/strong&gt;1, KEY_PARAM_VOLUME&lt;strong class="markup--strong markup--pre-strong"&gt;:&lt;/strong&gt; 0.5, KEY_PARAM_STREAM&lt;strong class="markup--strong markup--pre-strong"&gt;:&lt;/strong&gt; 'STREAM_MUSIC' } });&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;For more detail on &lt;code class="markup--code markup--p-code"&gt;androidParams&lt;/code&gt; properties, please take a look at &lt;a href="https://developer.android.com/reference/android/speech/tts/TextToSpeech.Engine.html" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;official android documentation&lt;/a&gt;. Please note that there are still unsupported key with this wrapper library such as &lt;code class="markup--code markup--p-code"&gt;KEY_PARAM_SESSION_ID&lt;/code&gt;. The following are brief summarization of currently implemented keys:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;code class="markup--code markup--li-code"&gt;KEY_PARAM_PAN&lt;/code&gt; ranges from &lt;code class="markup--code markup--li-code"&gt;-1&lt;/code&gt; to &lt;code class="markup--code markup--li-code"&gt;+1&lt;/code&gt;.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;code class="markup--code markup--li-code"&gt;KEY_PARAM_VOLUME&lt;/code&gt; ranges from &lt;code class="markup--code markup--li-code"&gt;0&lt;/code&gt; to &lt;code class="markup--code markup--li-code"&gt;1&lt;/code&gt;, where 0 means silence. Note that &lt;code class="markup--code markup--li-code"&gt;1&lt;/code&gt; is a default value for Android.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;For &lt;code class="markup--code markup--li-code"&gt;KEY_PARAM_STREAM&lt;/code&gt; the property, you can currently use one of &lt;code class="markup--code markup--li-code"&gt;STREAM_ALARM&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_DTMF&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_MUSIC&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_NOTIFICATION&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_RING&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_SYSTEM&lt;/code&gt;, &lt;code class="markup--code markup--li-code"&gt;STREAM_VOICE_CALL&lt;/code&gt;,&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Stop speaking and flush the TTS queue.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.stop();&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Waiting for initialization&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;On some platforms, it could take some time to initialize the TTS engine, and Tts.speak() will fail to speak until the engine is ready.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To wait for successful initialization you could use getInitStatus() call.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.getInitStatus().then(() =&amp;gt; {&lt;br&gt;Tts.speak('Hello, world!');&lt;br&gt;});&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Ducking&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Enable lowering other applications output level while speaking (also referred to as “ducking”).&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.setDucking(true);&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;List Voices&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Returns list of available voices&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;em class="markup--em markup--p-em"&gt;(not supported on Android API Level &amp;lt; 21, returns empty list)&lt;/em&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.voices().then(voices =&amp;gt; console.log(voices));&lt;br&gt;// Prints:&lt;br&gt;// [ { id: 'com.apple.ttsbundle.Moira-compact', name: 'Moira', language: 'en-IE', quality: 300 },&lt;br&gt;// ...&lt;br&gt;// { id: 'com.apple.ttsbundle.Samantha-compact', name: 'Samantha', language: 'en-US' } ]&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Voice fieldDescriptionidUnique voice identifier (e.g. &lt;code class="markup--code markup--p-code"&gt;com.apple.ttsbundle.Moira-compact&lt;/code&gt;)nameName of the voice &lt;em class="markup--em markup--p-em"&gt;(iOS only)&lt;/em&gt;languageBCP-47 language code (e.g. 'en-US')qualityVoice quality (300 = normal, 500 = enhanced/very high)latencyExpected synthesizer latency (100 = very low, 500 = very high) &lt;em class="markup--em markup--p-em"&gt;(Android only)&lt;/em&gt;networkConnectionRequiredTrue when the voice requires an active network connection &lt;em class="markup--em markup--p-em"&gt;(Android only)&lt;/em&gt;notInstalledTrue when the voice may need to download additional data to be fully functional &lt;em class="markup--em markup--p-em"&gt;(Android only)&lt;/em&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Set default Language&lt;/h3&gt;
&lt;pre class="graf graf--pre graf-after--h3"&gt;Tts.setDefaultLanguage('en-IE');&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Set default Voice&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Sets default voice, pass one of the voiceId as reported by a call to Tts.voices()&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;em class="markup--em markup--p-em"&gt;(not available on Android API Level &amp;lt; 21)&lt;/em&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.setDefaultVoice('com.apple.ttsbundle.Moira-compact');&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Set default Speech Rate&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Sets default speech rate. The rate parameter is a float where 0.01 is a slowest rate and 0.99 is the fastest rate.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.setDefaultRate(0.6);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;There is a significant difference to how the rate value is interpreted by iOS and Android native TTS APIs. To provide unified cross-platform behavior, translation is applied to the rate value. However, if you want to turn off the translation, you can provide optional &lt;code class="markup--code markup--p-code"&gt;skipTransform&lt;/code&gt; parameter to &lt;code class="markup--code markup--p-code"&gt;Tts.setDefaultRate()&lt;/code&gt; to pass rate value unmodified.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Do not translate the rate parameter:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.setDefaultRate(0.6, true);&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;Set default Pitch&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Sets default pitch. The pitch parameter is a float where 1.0 is a normal pitch. On iOS min, pitch is 0.5 and max pitch is 2.0&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;Tts.setDefaultPitch(1.5);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here in the tutorial, successfully implemented the plugin and got the perfect result. &lt;a href="https://github.com/mdshadman/RNInternationalizatio-TextToSpeech" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;You can follow all the steps and achieve this very easily or you can clone my repo on Github for both the implementations here and enjoy 😎 😎 😎 🕺 🕺 🕺..…&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to translate text in multi-language and text to speech and use it in React-Native applications. Since the packages are amazingly light and have great documentation, it is the developers’ first choice when it comes to creating translation app and text to speech.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/RNInternationalizatio-TextToSpeech" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;RNInternationalizatio-TextToSpeech&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;.&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of translation and text to speech in React-Native, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Auth&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>translation</category>
      <category>localization</category>
      <category>internationalization</category>
    </item>
    <item>
      <title>Progressive Web App (PWA) Features in Ionic 4</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sun, 29 Mar 2020 09:22:57 +0000</pubDate>
      <link>https://dev.to/enappd/progressive-web-app-pwa-features-in-ionic-4-1ggj</link>
      <guid>https://dev.to/enappd/progressive-web-app-pwa-features-in-ionic-4-1ggj</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this tutorial, we will learn all the features of PWA in ionic 4 considering why you should definitely consider PWA as your next project in Ionic 4.&lt;br&gt;What are the importance and benefits of PWA in ionic 4?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;This post is all about the features and advantages of PWA in your cool new app. In this post, you will learn in step by step&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;What is PWA and reason to use?&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;PWA&lt;/code&gt;in an Ionic app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Features of PWA in ionic app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li is-selected"&gt;Before start, first you will need an ionic app to start with, hence you can follow &lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create an ionic app for beginners&lt;/strong&gt;&lt;/a&gt; and start after that from here.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic 4&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;I know most of the readers reading this blog will know what is Ionic 4, but just for the sake of beginners, I explain this in every blog.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt; is a complete open-source SDK for hybrid mobile app development. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass. Apps can be built with these Web technologies and then distributed through native app stores to be installed on devices.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In other words — If you create native apps in Android, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Java&lt;/strong&gt;. If you create native apps in iOS, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Obj-C&lt;/strong&gt; or &lt;strong class="markup--strong markup--p-strong"&gt;Swift&lt;/strong&gt;. Both of these are powerful, but complex languages. With Cordova (and Ionic) you can write a single piece of code for your app that can run on both iOS and Android (and windows!), that too with the simplicity of HTML, CSS, and JS. I’m a huge fan of Ionic and been developing Ionic apps for last 4 years.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is PWA?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;By now, you’ve probably heard that Progressive Web Apps are the future of all mankind. They’ll bring world peace, end hunger, save the rainbows and unicorns, bring balance to the force, and a whole lot more. In the process, they might even push the mobile web forward, bring parity to web and native apps, and help mobile developers reach more users beyond the confines of the app stores.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;That all sounds great…but what &lt;em class="markup--em markup--p-em"&gt;are&lt;/em&gt; Progressive Web Apps, exactly?&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf--startsWithDoubleQuote graf-after--p"&gt;
&lt;em class="markup--em markup--blockquote-em"&gt;“A Progressive Web App uses modern web capabilities to deliver an app-like user experience.” — &lt;/em&gt;&lt;a href="https://developers.google.com/web/progressive-web-apps?hl=en" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Progressive Web Apps&lt;/em&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Native app store apps do things like send push notifications, work offline, look and feel like an app (as Apple and Google have imagined them), load on the home screen, and so on and so forth. Mobile Web Apps accessed in a mobile browser, by comparison, historically haven’t done those things. Progressive Web Apps fix that with new Web APIs, new design concepts, and new buzzwords.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To be clear, I’m talking about &lt;em class="markup--em markup--p-em"&gt;browser&lt;/em&gt; mobile web apps. Hybrid apps, like Ionic with Cordova, run uninhibited in the native app environment, with all the features we expect of any native app. But pull out the web content from a hybrid app and load it in a mobile browser, and the app is thusly constrained by the features of the browser (for a variety of good security and API standardization reasons).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Progressive Web Apps bring features we expect from native apps to the mobile browser experience in a way that uses standards-based technologies and run in a secure container accessible to anyone on the web.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;On the whole, Progressive Web Apps describe a collection of technologies, design concepts, and Web APIs that work in tandem to provide an app-like experience on the mobile web. Let’s walk through some of the core tenets of Progressive Web Apps.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Why do we need Progressive Web Apps?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To understand why we need progressive web apps, let’s first talk about some of the biggest challenges we are facing today with native and responsive web apps:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Internet speed&lt;/strong&gt;: depending on where you live internet may be a nightmare. You may have not realized this, but 60% of the world’s population is still using 2G internet.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Slow website load&lt;/strong&gt;: Do you know how long a user waits to close a website if it’s too slow? Only three seconds! 53% of users abandon a website if it loads too slow.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;High friction&lt;/strong&gt;: People don’t want to install native apps. An average user installs 0 applications in a month. Contrast this with how many new web sites they visit each month. Also, think about how many apps you downloaded and eventually ended up using just once or very few times?&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;User engagement&lt;/strong&gt;: Responsive mobile web sites have much more reach than native apps, however, they lack basic functionalities like push notifications and offline support. That causes that most of the users of responsive web sites are not actively engaged compared to native apps engagement levels.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;PWAs help in solving these problems. Let’s go through the main benefits of using progressive web apps.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Who’s building PWAs?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Brands large and small are jumping on Progressive Web Apps to create better user experiences, anywhere the web runs. Here are some of our favorites.&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Starbucks&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Pinterest&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Uber&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Twitter and many more…&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Features of Progressive Web App in ionic 4&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Some important and mindblowing features of PWA in ionic 4 are as follows —&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;i. Offline service Worker&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;ii. Firebase phone authentication&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;iii. Push notifications for web app&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;iv. Full-Screen browser mode&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;v. Launch from the user’s home screen&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;vi. Web app install banner prompt&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here we will discuss and implement each feature one by one but before that let’s implement PWA in an ionic 4 app by following these steps as I consider you have already created an application in ionic 4: —&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Right now my app looks like this:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--bYFY56fa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AY6Bqg4XCSqSmd4a86_JsHQ.png"&gt;&lt;br&gt;Basic ionic 4 app screen&lt;p class="graf graf--p graf-after--figure"&gt;Let's add some pages and styles in the above default created application.&lt;br&gt;Now make some changes by creating some attractive pages and check it out.&lt;br&gt;Before these, let's check the package.json of the current ionic 4 application.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;{&lt;br&gt;"name": "IONICPWA",&lt;br&gt;"version": "0.0.1",&lt;br&gt;"author": "Ionic Framework",&lt;br&gt;"homepage": "&lt;a href="https://ionicframework.com/"&gt;https://ionicframework.com/&lt;/a&gt;",&lt;br&gt;"scripts": {&lt;br&gt;"ng": "ng",&lt;br&gt;"start": "ng serve",&lt;br&gt;"build": "ng build",&lt;br&gt;"test": "ng test",&lt;br&gt;"lint": "ng lint",&lt;br&gt;"e2e": "ng e2e"&lt;br&gt;},&lt;br&gt;"private": true,&lt;br&gt;"dependencies": {&lt;br&gt;"@angular/common": "~8.1.2",&lt;br&gt;"@angular/compiler": "~8.1.2",&lt;br&gt;"@angular/core": "~8.1.2",&lt;br&gt;"@angular/forms": "~8.1.2",&lt;br&gt;"@angular/platform-browser": "~8.1.2",&lt;br&gt;"@angular/platform-browser-dynamic": "~8.1.2",&lt;br&gt;"@angular/router": "~8.1.2",&lt;br&gt;"@ionic-native/core": "^5.0.0",&lt;br&gt;"@ionic-native/splash-screen": "^5.0.0",&lt;br&gt;"@ionic-native/status-bar": "^5.0.0",&lt;br&gt;"@ionic/angular": "^4.7.1",&lt;br&gt;"core-js": "^2.5.4",&lt;br&gt;"rxjs": "~6.5.1",&lt;br&gt;"tslib": "^1.9.0",&lt;br&gt;"zone.js": "~0.9.1"&lt;br&gt;},&lt;br&gt;"devDependencies": {&lt;br&gt;"@angular-devkit/architect": "~0.801.2",&lt;br&gt;"@angular-devkit/build-angular": "~0.801.2",&lt;br&gt;"@angular-devkit/core": "~8.1.2",&lt;br&gt;"@angular-devkit/schematics": "~8.1.2",&lt;br&gt;"@angular/cli": "~8.1.2",&lt;br&gt;"@angular/compiler": "~8.1.2",&lt;br&gt;"@angular/compiler-cli": "~8.1.2",&lt;br&gt;"@angular/language-service": "~8.1.2",&lt;br&gt;"@ionic/angular-toolkit": "~2.0.0",&lt;br&gt;"@types/jasmine": "~3.3.8",&lt;br&gt;"@types/jasminewd2": "~2.0.3",&lt;br&gt;"@types/node": "~8.9.4",&lt;br&gt;"codelyzer": "^5.0.0",&lt;br&gt;"jasmine-core": "~3.4.0",&lt;br&gt;"jasmine-spec-reporter": "~4.2.1",&lt;br&gt;"karma": "~4.1.0",&lt;br&gt;"karma-chrome-launcher": "~2.2.0",&lt;br&gt;"karma-coverage-istanbul-r&lt;br&gt;eporter": "~2.0.1",&lt;br&gt;"karma-jasmine": "~2.0.1","karma-jasmine-html-reporter": "^1.4.0",&lt;br&gt;"protractor": "~5.4.0",&lt;br&gt;"ts-node": "~7.0.0",&lt;br&gt;"tslint": "~5.15.0",&lt;br&gt;"typescript": "~3.4.3"&lt;br&gt;},&lt;br&gt;"description": "An Ionic project"&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;The result after some UI changes: —&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dqq_eiZI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AJc6M40C6kabLElnA7oKQzg.png"&gt;&lt;br&gt;Card Page added&lt;p class="graf graf--p graf-after--figure"&gt;Let us convert the application in ionic 4 PWA application by following these steps…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The two main requirements of a PWA are a &lt;a href="https://developers.google.com/web/fundamentals/primers/service-workers/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Service Worker&lt;/a&gt; and a &lt;a href="https://developers.google.com/web/fundamentals/web-app-manifest/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Web Manifest&lt;/a&gt;. While it’s possible to add both of these to an app manually, the Angular team has an &lt;code class="markup--code markup--p-code"&gt;@angular/pwa&lt;/code&gt; package that can be used to automate this.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The &lt;code class="markup--code markup--p-code"&gt;@angular/pwa&lt;/code&gt; package will automatically add a service worker and an app manifest to the app. To add this package to the app, execute the following command in your project directory:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;ng add @angular/pwa&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The command automatically does the following:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Creates the configurations the service worker&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Creates a default iconography for PWA standards&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Updates the angular.json file to enable service worker support&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Add @angular/pwa to your package.json&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Adds the required meta tags to the index.html&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Creates a ngsw-config.json file with your PWA configs&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Once this package has been added run &lt;code class="markup--code markup--p-code"&gt;ionic build --prod&lt;/code&gt; and the &lt;code class="markup--code markup--p-code"&gt;www&lt;/code&gt; directory will be ready to deploy as a PWA.&lt;br&gt;After executing the above command in your project directory, will bring some changes in your package .json as —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--PcLYczG---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AIyI_6Nhrq1LRJm80JRxqBw.png"&gt;&lt;br&gt;Changes observed during installation&lt;p class="graf graf--p graf-after--figure"&gt;Two new files named &lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;manifest.webmanifest &lt;/em&gt;&lt;/strong&gt;and&lt;em class="markup--em markup--p-em"&gt; &lt;/em&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;ngsw-config.json &lt;/em&gt;&lt;/strong&gt;in your app’s files.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1iz6Txgq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A_L7FDgNpD5d9Cr8zRBeFtw.png"&gt;&lt;br&gt;ngsw-config.json&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--F1caUMBm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AGwdjKuYLqTcv0NuVRrmIuA.png"&gt;&lt;br&gt;package.json after PWA installation&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;and in app.module.ts&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--HvklsVZU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Ape8iO5iXxVp-CyrfkdAeIw.png"&gt;&lt;br&gt;app.module.ts&lt;p class="graf graf--p graf-after--figure"&gt;Now we have converted our application from native Ionic application to Ionic 4 PWA application.&lt;br&gt;Let us integrate service-worker in this application but before that, we should get to know what is service-worker and why we need this in ionic 4 application.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;&lt;strong class="markup--strong markup--h3-strong"&gt;Service-Worker in Ionic 4 PWA: —&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Perhaps the most critical step in transforming your Ionic application into a PWA is to set up a &lt;a href="https://developers.google.com/web/fundamentals/getting-started/primers/service-workers" class="markup--anchor markup--p-anchor" rel="noopener"&gt;service worker&lt;/a&gt;. A service worker is a script that runs separately to the application. It doesn’t have access to the DOM like a normal script would, but it can do things like handle network requests and caching.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Service Workers are an incredibly powerful, and equally as confusing, the technology behind a Progressive Web App. They power offline functionality, push notifications, background content updating, content caching, and a whole lot more.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;At a high level, a Service Worker is a worker script that works behind the scenes, independent of your app, and runs in response to events like network requests, push notifications, connectivity changes, and more.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If using service workers to handle network requests and cache resources sounds difficult there’s no need to worry — Ionic handles it all for us. The code for the service worker is already included in your Ionic application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;If an app is being deployed to other channels such as Cordova or Electron, you can remove the &lt;code class="markup--code markup--p-code"&gt;"serviceWorker": true&lt;/code&gt; flag from the &lt;code class="markup--code markup--p-code"&gt;angular.json&lt;/code&gt; file.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The service worker can be generated by running: we just need to execute the below command.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;ionic build --prod --service-worker&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote class="graf graf--blockquote graf-after--pre"&gt;Note: Features like Service Workers and many JavaScript APIs (such as geolocation) require the app be hosted in a secure context. When deploying an app through a hosting service, be aware that HTTPS will be required to take full advantage of Service Workers.&lt;/blockquote&gt;
&lt;h4 class="graf graf--h4 graf-after--blockquote"&gt;Firebase phone authentication: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Ionic 4 PWA gives us the facility to authenticate a user using phone authentication. With the help of phone authentication in your app, you can check or prevent a user from login application without registering for the application.&lt;br&gt;We will cover the firebase phone authentication in ionic 4 PWA application in the next blog.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Push Notifications in ionic 4 PWA Application: —&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Ok, I’ll try to define it in my own language. How do you know when you get a new message on Whatsapp, Facebook or Twitter if the app is closed? Yes, those small messages that pop down from the top of the screen, showing new messages, updates or news are called Push notifications (or simply Push)&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--3HWp3mG2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AgrLKk4kBhF2vvYuO.gif"&gt;&lt;br&gt;Yes, those …… are push notifications&lt;p class="graf graf--p graf-after--figure"&gt;One might wonder why to integrate Push notifications in an app. Let me tell you, push notifications is the &lt;strong class="markup--strong markup--p-strong"&gt;single biggest feature &lt;/strong&gt;to keep your users engaged with your app. People are obsessed with notifications. People keep checking their phones regularly so they don’t miss any notification. If your app sends regular (and interesting) push, your users will be happy, and you’ll see much less app uninstalls than you’ll see without push.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We will implement Push Notifications in ionic 4 PWA application in the nest blog&lt;strong class="markup--strong markup--p-strong"&gt;. &lt;/strong&gt;&lt;a href="https://medium.com/enappd/firebase-push-notifications-in-ionic-4-3c80f14777ec" class="markup--anchor markup--p-anchor"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;You can follow our Firebase push notification blog to implement in ionic 4 application.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;
&lt;a href="https://ionicframework.com/docs/publishing/progressive-web-app#deploying" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Deploying&lt;/a&gt; the application&lt;/h3&gt;
&lt;h3 class="graf graf--h3 graf-after--h3"&gt;&lt;a href="https://ionicframework.com/docs/publishing/progressive-web-app#firebase" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Firebase&lt;/a&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To deploy our app on firebase and test it online we need to create a firebase project for this application.&lt;br&gt;&lt;a href="https://medium.com/enappd/how-to-integrate-firebase-in-ionic-4-apps-15d76263d51" class="markup--anchor markup--p-anchor"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;To create a firebase project just follow this and start after completing the steps suggested in the blog.&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--p-strong"&gt; OR&lt;/strong&gt;&lt;a href="https://medium.com/enappd/firebase-with-ionic-4-hosting-auth-and-db-connection-ed9e99dc6642" class="markup--anchor markup--p-anchor"&gt;&lt;strong class="markup--strong markup--p-strong"&gt; you can follow this blog too.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, in a Terminal, install the Firebase CLI:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;$ npm install -g firebase-tools&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;With the Firebase CLI installed, run &lt;code class="markup--code markup--p-code"&gt;firebase init&lt;/code&gt; within your Ionic project. The CLI prompts:&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“Which Firebase CLI features do you want to set up for this folder?”&lt;/strong&gt; Choose “Hosting: Configure and deploy Firebase Hosting sites.”&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“Select a default Firebase project for this directory:”&lt;/strong&gt; Choose the project you created on the Firebase website.&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“What do you want to use as your public directory?”&lt;/strong&gt; Enter “www”.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;em class="markup--em markup--blockquote-em"&gt;Note: Answering these next two questions will ensure that routing, hard reload, and deep linking work in the app:&lt;/em&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Configure as a single-page app (rewrite all urls to /index.html)?”&lt;/strong&gt; Enter “Yes”.&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“File www/index.html already exists. Overwrite?”&lt;/strong&gt; Enter “No”.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A &lt;code class="markup--code markup--p-code"&gt;firebase.json&lt;/code&gt; config file is generated, configuring the app for deployment.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;I hope you have successfully done all the steps above and ready to deploy your app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, build an optimized version of the app by running:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;$ ionic build --prod&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Last, deploy the app by running:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;$ firebase deploy&lt;/code&gt;&lt;/pre&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--c7Lw3oT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AvpxiRdZKbKMycj-9ZNp-Sw.png"&gt;&lt;br&gt;App deployed on firebase&lt;p class="graf graf--p graf-after--figure"&gt;When you hit the deployed url then you will get the following results&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--vvFWpoMe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AzkM6QoWN8ndCk551BrNaYw.jpeg"&gt;&lt;br&gt;Prompt to add on the device screen&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--wkSGNW8_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A_LaPyGJQqqbTdZ9UnyptPw.jpeg"&gt;&lt;br&gt;prompt to confirm add to the home screen&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CAVT-pxE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A1KiaYGPai6gHcVDJ7ZKdeg.jpeg"&gt;&lt;br&gt;added to home screen&lt;p class="graf graf--p graf-after--figure"&gt;I the above image we can see that the app icon is an angular icon, here angular provides its default icon in the manifest. You can change the icon by generating required sizes and add it in the assets folder and edit the &lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;manifest.webmanifest &lt;/em&gt;&lt;/strong&gt;file&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--p0QBuwUa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ADFVGF7fNPQyAyJsU6-joyA.png"&gt;&lt;br&gt;&lt;strong class="markup--strong markup--figure-strong"&gt;&lt;em class="markup--em markup--figure-em"&gt;manifest.webmanifest&lt;/em&gt;&lt;/strong&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Now you are all set and ready to add multiple features in your ionic 4 PWA application.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Progressive Web Apps are equal parts of new Web APIs, design patterns, and marketing fluff. The mobile web comes closer to parity with installable app store apps through app manifest and homescreen install support, background worker functionality with Service Workers, faster load time with App Shell, and a renewed belief that web developers, too, can build amazing mobile app experiences.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the features and implementation of PWA in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic 4 Payment Gateways — &lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe&lt;/a&gt; | &lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="noopener"&gt;PayPal&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-razorpay-in-ionic-4-apps-and-pwa/20" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RazorPay&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Charts with — &lt;a href="https://enappd.com/blog/ionic-4-charts-using-google-charts/66" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Charts &lt;/a&gt;| &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-3/60" class="markup--anchor markup--li-anchor" rel="noopener"&gt;HighCharts&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-2/54" class="markup--anchor markup--li-anchor" rel="noopener"&gt;d3.js&lt;/a&gt; | &lt;a href="https://enappd.com/blog/charts-in-ionic-4-apps-and-pwa-part-1/52" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Chart.js&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Social Logins — &lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Authentications — &lt;a href="https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Via Email&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Features — &lt;a href="https://enappd.com/blog/using-geolocation-geocoding-and-reverse-geocoding-in-ionic-4/45" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4/9" class="markup--anchor markup--li-anchor" rel="noopener"&gt;QR Code reader &lt;/a&gt;| &lt;a href="https://enappd.com/blog/best-fitness-plugins-for-ionic-4-how-to-use-pedometer/15" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Pedometer&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Media in Ionic 4 — &lt;a href="https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Audio&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-video-player-in-ionic-4-app/64" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Video&lt;/a&gt; | &lt;a href="https://enappd.com/blog/image-picker-in-ionic-4-app/67" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-add-image-cropper-in-ionic-4-app/68" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Cropper&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Essentials — &lt;a href="https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Native Storage&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-ionic-4-globalization-internationalization-and-localization/11" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translations&lt;/a&gt; | &lt;a href="https://enappd.com/blog/rtl-right-to-left-use-in-ionic-4/50" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RTL&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 messaging — &lt;a href="https://enappd.com/blog/implement-ionic-4-firebase-push/34" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push&lt;/a&gt; | &lt;a href="https://enappd.com/blog/automatically-read-sms-in-ionic-4-apps/42" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Reading SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/local-notifications-in-ionic-4/69" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Local notification&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 with Firebase — &lt;a href="https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Basics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Cloud functions&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;You may also check our Ionic 4 PWA works: —&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;a href="https://store.enappd.com/product/ionic-4-food-ordering-pwa-app-starter/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;&lt;/a&gt;&lt;a href="https://store.enappd.com/product/ionic-4-food-ordering-pwa-app-starter/"&gt;https://store.enappd.com/product/ionic-4-food-ordering-pwa-app-starter/&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://store.enappd.com/product/ionic-4-spotify-pwa-app-starter/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;&lt;/a&gt;&lt;a href="https://store.enappd.com/product/ionic-4-spotify-pwa-app-starter/"&gt;https://store.enappd.com/product/ionic-4-spotify-pwa-app-starter/&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://store.enappd.com/product/ionic-4-grocery-complete-platform-app-and-admin-dashboard/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;&lt;/a&gt;&lt;a href="https://store.enappd.com/product/ionic-4-grocery-complete-platform-app-and-admin-dashboard/"&gt;https://store.enappd.com/product/ionic-4-grocery-complete-platform-app-and-admin-dashboard/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;if you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--m0n2v3Sz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2A4e8jjvR9koEND5aL.jpeg"&gt;

</description>
      <category>ionic</category>
      <category>pwa</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Implement Google Vision in React Native apps</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sat, 28 Mar 2020 11:09:10 +0000</pubDate>
      <link>https://dev.to/enappd/implement-google-vision-in-react-native-apps-2jl3</link>
      <guid>https://dev.to/enappd/implement-google-vision-in-react-native-apps-2jl3</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this tutorial you will get know how can we integrate Google Vision API in our React Native application and get responses on text and image recognition. The app supports various features including but not limited to Object Detection, Labeling Images, Text Recognition, Face Detection using Google Vision API.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;a href="https://github.com/mdshadman/ReactNativeGoogleVision" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial can be found at&lt;em class="markup--em markup--blockquote-em"&gt; &lt;/em&gt;ReactNativeGoogleVision&lt;/strong&gt;&lt;/a&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote is-selected"&gt;In this tutorial we will focus on some basic and major parts where many expert developers or juvenile beginners gets confused. Hence we will check each and every things in step-by-step as: —&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;What and why React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;What and why Google Vision API&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to create react native app&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to get google vision API key&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Implementation and setup&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Working example&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 class="graf graf--h4 graf-after--li"&gt;
&lt;strong class="markup--strong markup--h4-strong"&gt;Step 1: — &lt;/strong&gt;What and why React Native ?&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML-Esque markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this tutorial, we’ll cover firebase phone authentication and CRUD operations. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some anecdota: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;br&gt; The fact that React Native actually renders using its host platform’s standard rendering APIs enables it to stand out from most existing methods of cross-platform application development, like Cordova or Ionic.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Existing methods of writing mobile applications using combinations of JavaScript, HTML, and CSS typically render using webviews. While this approach can work, it also comes with drawbacks, especially around performance. Additionally, they do not usually have access to the host platform’s set of native UI elements. When these frameworks do try to mimic native UI elements, the results usually “feel” just a little off; reverse-engineering all the fine details of things like animations takes an enormous amount of effort, and they can quickly become out of date.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Step 2: — What and why Google Vision API ?&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Google Vision API is also known as Cloud Vision API.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Cloud Vision API allows developers to easily integrate vision detection features including image labeling, face, and landmark detection, optical character recognition (OCR), and tagging of explicit content, within applications.&lt;br&gt;Cloud Vision API offers us the following features to be applied on the images as follow: —&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;features: [&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "LABEL_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "LANDMARK_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "FACE_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "LOGO_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "TEXT_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "DOCUMENT_TEXT_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "SAFE_SEARCH_DETECTION" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "IMAGE_PROPERTIES" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "CROP_HINTS" },&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;{ type: "WEB_DETECTION" }&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;],&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;For more information about Google Vision API, go to its official documentation &lt;a href="https://cloud.google.com/vision/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;here&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;Brief History of Machine Learning&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Arthur Samuel&lt;/strong&gt;, a pioneer in the field of artificial intelligence and computer gaming, coined the term &lt;strong class="markup--strong markup--p-strong"&gt;“Machine Learning”&lt;/strong&gt;. He defined machine learning as — &lt;strong class="markup--strong markup--p-strong"&gt;“Field of study that gives computers the capability to learn without being explicitly programmed”&lt;/strong&gt;.&lt;br&gt;In a very layman manner, Machine Learning(ML) can be explained as automating and improving the learning process of computers based on their experiences without being actually programmed i.e. without any human assistance. The process starts with feeding good quality data and then training our machines(computers) by building machine learning models using the data and different algorithms.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;ML is one of the most impressive technologies that one would have ever come across.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Step 3: — How to create react native app ?&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now till here, i expect all of you have created your own react-native projects.&lt;br&gt;Google Cloud’s Vision API offers robust pre-trained machine learning models through REST and RPC APIs. It assigns labels to images and quickly classifies them into millions of predefined classes or categories. It can detect objects and faces, read the printed or handwritten text, and build valuable metadata into your image catalog.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Step 4: —How to get google vision API key ?&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Google Cloud’s Vision API offers robust pre-trained machine learning models through REST and RPC APIs. It assigns labels to images and quickly classifies them into millions of predefined classes or categories. It can detect objects and faces, read the printed or handwritten text, and build valuable metadata into your image catalog.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For implementing Google Vision in your react-native app, you can visit the given &lt;a href="https://cloud.google.com/vision/docs/quickstart-client-libraries#client-libraries-install-nodejs" class="markup--anchor markup--p-anchor" rel="noopener"&gt;link&lt;/a&gt; or, follow certain steps:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;a href="https://accounts.google.com/Login" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Sign in&lt;/a&gt; to your Google Account.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Select or Create a &lt;a href="https://console.cloud.google.com/cloud-resource-manager?_ga=2.158392121.-227962472.1559537135" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Cloud Platform Project&lt;/a&gt;.Please make sure that billing is enabled for your Google Cloud Platform project. To enable billing, follow the procedure provided in the given &lt;a href="https://cloud.google.com/billing/docs/how-to/modify-project" class="markup--anchor markup--li-anchor" rel="noopener"&gt;link&lt;/a&gt;.&lt;strong class="markup--strong markup--li-strong"&gt;N.B.:&lt;/strong&gt; You will not be able to get any response from API until you enable the billing.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;To Enable the Cloud Vision API.→ First, &lt;a href="https://console.cloud.google.com/flows/enableapi?apiid=vision-json.googleapis.com%2526_ga=2.128126991.-227962472.1559537135" class="markup--anchor markup--li-anchor" rel="noopener"&gt;select&lt;/a&gt; a project.→ After selecting the project, click on “Go to API’s overview” button.→ Click on “Enable API and Services”,→ Search for Cloud Vision API.→ Click on the enable button.→ To use this API, click on Create Credentials.→ Choose the Cloud Vision API from the list.→ Click on “Yes I’m using one or both” and proceed further.→ Click on the Done button.→ Click on “Create Credentials”.→ Click “API key” from options.→ Copy the API key popped up and save it at a safer place. It should not be made public.→ Click the close button.&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Congrats Your API key has been generated.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now you are all set to start with google vision but before wo start coding let us integrate the most important thing for this application and that is the Camera on, so we will use react-native-camera npm package to take pictures and send those to the Google Vision API for responses,&lt;br&gt;Here I would like to inform you that the react-native-camera npm package has some bugs so you would need to install this package from the master branch.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Execute the command below to integrate camera in your application: —&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;yarn add react-native-camera@git+&lt;a href="https://git@github.com/react-native-community/react-native-camera.git"&gt;https://git@github.com/react-native-community/react-native-camera.git&lt;/a&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;a href="https://github.com/react-native-community/react-native-camera" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;You can get help from here if you get any common issues while integrating it.&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Step 5: — Implementation and setup&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;We are now totally set to do some magic with image and google vision API , So let set go for the magic to happen…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;First of all let us make some cool UI for opening the camera and showing the result.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Code View: —&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Result: —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--yAeZyPGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Av7NHTFCaky5fZEHnQlzIsA.jpeg"&gt;&lt;br&gt;Click on scan button to open camera&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--pWZTUE2R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A9L60TgxoKdBEbPCA9lwLfw.jpeg"&gt;&lt;br&gt;Camera on mode&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--nBZc9z2Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ASrdmYekkKZeudXhqWbDlqA.jpeg"&gt;&lt;br&gt;Loading response&lt;p class="graf graf--p graf-after--figure"&gt;logicView: —&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Result: —&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--5mGF1Qq2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AKzn9ZqR44lC3dV6Una9pZw.jpeg"&gt;&lt;br&gt;Google Vision responses&lt;p class="graf graf--p graf-after--figure"&gt;Here, we have used react-native fetch method to call the API using POST method and receive the response with that.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In the code above you have &lt;strong class="markup--strong markup--p-strong"&gt;“config.googleCloud.api + config.googleCloud.apiKey” &lt;/strong&gt;which will be google cloud api and another is your api which you get after creating account and activating Google Vision Api in google console.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In the above images i have only printed webEntities responses but you can pass the features in the body and get the required responses.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;a href="https://github.com/mdshadman/ReactNativeGoogleVision" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial can be found at&lt;em class="markup--em markup--blockquote-em"&gt; &lt;/em&gt;ReactNativeGoogleVision&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; .&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this blog, you learnt how to implement Google Vision API in React Native apps for Android. You also learnt how to integrate react-native-camera in react-native application. We also built the app in Android and ran on a device.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;a href="https://github.com/mdshadman/ReactNativeGoogleVision" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial can be found at&lt;em class="markup--em markup--blockquote-em"&gt; &lt;/em&gt;ReactNativeGoogleVision&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; .&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learnt about setting up to implement Google Vision API in React Native apps for Android, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>googlecloud</category>
      <category>googlevision</category>
      <category>imagedetection</category>
    </item>
    <item>
      <title>Twitter Login in React Native Apps Using Firebase</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Sat, 28 Mar 2020 10:17:18 +0000</pubDate>
      <link>https://dev.to/enappd/twitter-login-in-react-native-apps-using-firebase-kie</link>
      <guid>https://dev.to/enappd/twitter-login-in-react-native-apps-using-firebase-kie</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;In this tutorial, you will get to know how we can implement both &lt;strong class="markup--strong markup--p-strong"&gt;React-Native Firebase Social Auth&lt;/strong&gt; T&lt;strong class="markup--strong markup--p-strong"&gt;witter login&lt;/strong&gt; in our app and how to integrate &lt;code class="markup--code markup--p-code"&gt;react-native-twitter-signin &lt;/code&gt;npm package for twitter login in our cool application, and then test it &lt;strong class="markup--strong markup--p-strong"&gt;on Android&lt;/strong&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/RNFirebaseTwitterLogin" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;React-Native-twitter-login (android branch)&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Twitter Login — What and why?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;There are several reasons why you should use a Twitter login in your app&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Ease of use&lt;/strong&gt; — When a new user uses your app, only two buttons clicks are required to login using Twitter. In other scenario, user will have to type in an email/password and login&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;No “forgot password” &lt;/strong&gt;— When your app uses Twitter login, the user does not have to worry about forgetting password for your app’s login&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;No “verify email”&lt;/strong&gt; — If you use a custom-email authentication of your own, you will have to verify the email if it is a valid one or not. Twitter login will always have a valid email/phone number associated.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Single solution — &lt;/strong&gt;Twitter login can allow your users to use single login credentials across multiple devices&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Twitter integration&lt;/strong&gt; — If your app uses Twitter authentication, you can use Twitter APIs inside your app as well. This can include fetching user tweets etc.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Trust&lt;/strong&gt; — Nowadays, people generally trust social logins more over custom email logins. Social logins follows standard privacy protocols and hence are more reliable for information sharing.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;Authentication in React Native&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native has been around us for around 4 years and has been very popular among developers for its ease of usage over Swift / Java. Also, you get to keep single source code for both Android and iOS app. What more can a developer ask for!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native 0.60.5 is the latest version (at the time of writing this post), and is much more reliable and robust than previous versions. It also includes breaking changes related to AndroidX, but don’t worry we’ll create an Android test app as well.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;There are several ways of Authentication in React Native Apps&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Social logins &lt;/strong&gt;— Social logins are a popular and easy way of authentication in mobile apps. You must have seen Google, Facebook, Instagram logins in almost all the modern apps. Social logins are easy to use and more reliable for quick integrations.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Create your own back-end&lt;/strong&gt; — You can create your own back-end in Node.js, Go, Django or Ruby-on-rails, and connect your app authentication to your own back-end. This method is favored by developers who need full control over the user authentication. But this method is the most time taking one as well.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;strong class="markup--strong markup--li-strong"&gt;Back-end as a Service (BaaS) — &lt;/strong&gt;You&lt;strong class="markup--strong markup--li-strong"&gt; &lt;/strong&gt;can use pre-built BaaS platforms which allows easy integration of authentication in your apps. Basically, these platforms provide you a ready-made back-end, so you don’t have to make one on your own. Firebase, Parse, Back4App are some BaaS platforms.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;em class="markup--em markup--p-em"&gt;Firebase&lt;/em&gt;&lt;/strong&gt; is the most popular among these for mobile apps, which we’ll study in the next section&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Firebase&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Firebase &lt;/strong&gt;is a Backend-as-a-Service (BaaS) platform. It started as a &lt;a href="http://blog.ycombinator.com/firebase-yc-s11-raises-5-dollars-dot-6m-series-a-from-union-square-ventures-and-flybridge" class="markup--anchor markup--p-anchor" rel="noopener"&gt;YC11 startup&lt;/a&gt; and grew up into a next-generation app-development platform on Google Cloud Platform. It is getting popular by the day because of the ease of integration and a variety of functionalities available on it.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A lot of quick integrations are available with Firebase. Some of these are listed below:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Real-time database&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Email Authentication&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;Social logins&lt;/strong&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;In-app messages&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Push notifications&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Analytics&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Crashlytics&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Remote config&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Firebase is quickly growing to become the most popular mobile app back-end platform.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Firebase Authentication Options&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Firebase not only provides ready-made email authentication but also provides authentication using variety of social logins. You can see the authentication options available with Firebase&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--eBrHrub0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AX3mXZsyay3Q1ZUVo.png"&gt;&lt;br&gt;Authentication options available in Firebase&lt;p class="graf graf--p graf-after--figure"&gt;We will use Firebase to store user profile information once the Twitter login is done. This is the preferred method, as it is reliable for both apps and PWA.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Steps for Twitter authentication&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;We will follow these step-by-step instructions to create our React Native app with Twitter authentication&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Step 1: Create a Firebase Project and Add android platform&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌Step 2: Enable Twitter Sign-In in Firebase project&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Step 3: Create a Basic React Native app&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌Step 4: Install the &lt;code class="markup--code markup--p-code"&gt;react-native-twitter-signin&lt;/code&gt; package for Twitter Login&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Step 5: Implement Twitter auth functions in RN app&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Step 6: Test your app on Android&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Step 7: Use Firebase to store user info and handle Auth&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;So let’s jump right in&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 0: Create a SHA-1 Signature&lt;/h3&gt;
&lt;blockquote class="graf graf--blockquote graf-after--h3"&gt;This is an important step where many developers commit mistake. That’s why Step 0&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;This is a way for the app and Firebase to recognize the system from which the app was developed. It is generated based on the system and your&lt;code class="markup--code markup--p-code"&gt;keystore&lt;/code&gt;file.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Generate the key using the following steps : —&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Method 1: —&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;step 1:-- Open &lt;code class="markup--code markup--pre-code"&gt;Android Studio&lt;br&gt;step 2:-- &lt;/code&gt;Open Your Project&lt;br&gt;step 3:-- Click on &lt;strong class="markup--strong markup--pre-strong"&gt;Gradle&lt;/strong&gt; (From &lt;strong class="markup--strong markup--pre-strong"&gt;Right Side Panel&lt;/strong&gt;, you will see &lt;strong class="markup--strong markup--pre-strong"&gt;Gradle Bar&lt;/strong&gt;)&lt;br&gt;step 4:--  Click on &lt;strong class="markup--strong markup--pre-strong"&gt;Refresh&lt;/strong&gt; (Click on Refresh from Gradle Bar , you              will see List Gradle scripts of your Project)&lt;br&gt;step 5:-- Click on Your Project (Your Project Name form List)&lt;br&gt;step 6:-- Click on Tasks/Android&lt;br&gt;step 7:-- Double Click on &lt;code class="markup--code markup--pre-code"&gt;signingReport&lt;/code&gt; (You will get &lt;code class="markup--code markup--pre-code"&gt;SHA1&lt;/code&gt; and &lt;code class="markup--code markup--pre-code"&gt;MD5&lt;/code&gt; in Run Bar).&lt;br&gt;Now you are all done , check your keys in results.&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Method 2: —&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Generate the key using the following command&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ keytool -exportcert -keystore &amp;lt;&amp;lt;keystore file location&amp;gt;&amp;gt; -list -v&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Important: &lt;/strong&gt;This is where many people commit a mistake. The &lt;code class="markup--code markup--p-code"&gt;keystore&lt;/code&gt; file in the above command is NOT the default &lt;code class="markup--code markup--p-code"&gt;keystore&lt;/code&gt; file of your system. React Native automatically generates a &lt;code class="markup--code markup--p-code"&gt;debug.keystore&lt;/code&gt; for your Android project, which resides in the Android project folder.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 1: Create a Firebase Project&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;For authentication, we need a back-end. For this tutorial, Firebase is our back-end, so we need to configure a few things in Firebase. First of all, we’ll create a new Firebase project and new app inside it.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;1.1 If you don’t have an existing Firebase Project&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;If you already have a Firebase project, skip to step 1.2. Otherwise, create a new Firebase project by going to &lt;a href="https://firebase.google.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Firebase Console&lt;/a&gt;. Give your project a name and that’s it!&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--5B_b9vX4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AoxNBmImt5P-OnbKCz5MGiA.png"&gt;&lt;h4 class="graf graf--h4 graf-after--figure"&gt;1.2 Create and attach new app to the project&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now that the project is created, create a new Android app in the project dashboard.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--0DfweEAc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AG0TF-UwnSuuvcOWpWh1uiQ.png"&gt;&lt;br&gt;Add new app to the project&lt;p class="graf graf--p graf-after--figure"&gt;Add the &lt;code class="markup--code markup--p-code"&gt;SHA1&lt;/code&gt; key you generated in Step 0 and add it in &lt;code class="markup--code markup--p-code"&gt;Debug signing certificate SHA-1&lt;/code&gt; field&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--RdvTGz1J--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Ax45CZ61SIYVPEp59vW8Qag.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Just mention the correct package name of your app in the &lt;code class="markup--code markup--p-code"&gt;Android package name&lt;/code&gt;input. For me, it is &lt;strong class="markup--strong markup--p-strong"&gt;com.twitterlogin&lt;/strong&gt;. Give it a nickname to remember.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next step, download the &lt;code class="markup--code markup--p-code"&gt;google-services.json&lt;/code&gt; file and put it in the &lt;code class="markup--code markup--p-code"&gt;android/app&lt;/code&gt;folder of your project. You can skip the rest of the steps for now. Your app is created now, and you should see it in the dashboard.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;‌Step 2: Enable Twitter Login in Firebase&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that your app is connected to Firebase project, we need to go into our Firebase console and enable Twitter authentication for our app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;‌Once you’re inside the app’s dashboard, you’re going to go into&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Authentication → Sign-In Method → Twitter&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;and click the &lt;code class="markup--code markup--p-code"&gt;Enable&lt;/code&gt; toggle.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--qj53zo4A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A07lM4VGKAAzkXISY-bXQiQ.png"&gt;&lt;br&gt;Enable google-login and save Web-client ID&lt;p class="graf graf--p graf-after--figure"&gt;Give a name to for your &lt;strong class="markup--strong markup--p-strong"&gt;Auth consent screen &lt;/strong&gt;and save your &lt;strong class="markup--strong markup--p-strong"&gt;web client Id&lt;/strong&gt; as well. This will be used to integrate the React Native app with Firebase.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 3: Create a basic React Native app&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;First, make sure you have all pre-requisites to create a react-native app as per the &lt;a href="https://facebook.github.io/react-native/docs/getting-started.html" class="markup--anchor markup--p-anchor" rel="noopener"&gt;official documentation&lt;/a&gt;.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;At the time of this post, I have React-Native version 0.60.5&lt;/strong&gt;&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Create a blank react-native app (Replace &lt;code class="markup--code markup--p-code"&gt;myApp&lt;/code&gt; with your own name)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native init RNTwitterLogin&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This will create a basic React-native app which you can run in a device or simulator. (let’s run Android)&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Let’s run the app in Android using (I’m using a real device)&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ react-native run-android&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You’ll see the default start screen&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--UIavk9-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ATnZfGsKdsWGBUac-0YutpA.jpeg"&gt;&lt;br&gt;Default start screen for React Native app&lt;p class="graf graf--p graf-after--figure"&gt;Change the UI of this front page by changing &lt;code class="markup--code markup--p-code"&gt;App.js&lt;/code&gt; and the page will look like this.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Code View: —&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Result: —&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--96eiQ6Gr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2svQUI9A413tobFdhBfa7w.jpeg"&gt;&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 4: Install the package for Twitter Login using &lt;code class="markup--code markup--h3-code"&gt;react-native-twitter-signin package&lt;/code&gt;
&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To enable Twitter Login, we’ll install a package named &lt;a href="https://github.com/react-native-community/react-native-google-signin" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;react-native-twitter-signin&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--p-strong"&gt;. &lt;/strong&gt;This is a widely used package for Twitter Login, and also very reliable.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;4.1 Install package&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Install the package using&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;$ &lt;code class="markup--code markup--pre-code"&gt;yarn add react-native-twitter-signin &lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Linking the package is not required above react-native version 0.60.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;4.2 Make sure you have latest SDK and other android packages&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You should always try to stay updated with latest Android SDK and other packages. At the time of this post, my Android SDK is 9.0 (Pie) and here’s a list of my other packages&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CpDc4YGW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2Af5DiUCEMJJam8Vs9-szRjQ.png"&gt;&lt;h4 class="graf graf--h4 graf-after--figure"&gt;4.3 Add google-services.json file to project&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;If you haven’t done it yet, download the &lt;code class="markup--code markup--p-code"&gt;google-services.json&lt;/code&gt; file from your Firebase project and put it in the &lt;code class="markup--code markup--p-code"&gt;android/app&lt;/code&gt;folder of your RN project.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--4KOfvYRH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AKKAaGC0kVAsdf13uXgANGg.png"&gt;&lt;br&gt;Place google-services.json in android/app folder&lt;p class="graf graf--p graf-after--figure"&gt;Now let's see some tricky parts for this package —&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;There is an unknown error which has very less solution on any platform like StackOverflow or others but I found that solution after too many hecks,&lt;br&gt;First of all, you need to install the below package to get it in work&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install --save GoldenOwlAsia/react-native-twitter-signin#master&lt;br&gt;instead of&lt;br&gt;&lt;code class="markup--code markup--pre-code"&gt;yarn add react-native-twitter-signin&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now you are all set to install packages&lt;br&gt;&lt;strong class="markup--strong markup--p-strong"&gt;4.3.1: —&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Go to &lt;a href="https://apps.twitter.com/" class="markup--anchor markup--p-anchor" rel="nofollow noopener"&gt;Twitter Apps&lt;/a&gt; to create your app so that you can obtain API key and secret, note:&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Remember to set a Callback Url, whatever will work&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;By default, Twitter won’t allow you to grab user’s email, so you have to apply for permission for your app to retrieve user’s email&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Here is how callbacks would look like:&lt;/li&gt;
&lt;/ul&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--q_KrbN1O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/0%2AVXZ7K7-odlpXF0yS"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;It may take up to 72 hrs to verify your developer's account, so stay calm and code rest!&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;4.4 Update Android configuration files&lt;/h4&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--h4"&gt;Update &lt;code class="markup--code markup--li-code"&gt;android/build.gradle&lt;/code&gt; with latest versions. My configuration is&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;buildscript&lt;/strong&gt; {&lt;br&gt;ext {&lt;br&gt;buildToolsVersion = "28.0.3"&lt;br&gt;minSdkVersion = 16&lt;br&gt;compileSdkVersion = 28&lt;br&gt;targetSdkVersion = 28&lt;br&gt;supportLibVersion = "28.0.0"&lt;br&gt;}&lt;br&gt;...&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;dependencies&lt;/strong&gt; {&lt;br&gt;classpath 'com.android.tools.build:gradle:3.4.1' // &amp;lt;--- use this version or newer&lt;br&gt;classpath 'com.google.gms:google-services:4.3.0' // &amp;lt;--- use this version or newer&lt;br&gt;}&lt;br&gt;...&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;allprojects&lt;/strong&gt; {&lt;br&gt;repositories {&lt;br&gt;mavenLocal()&lt;br&gt;google() // &amp;lt;--- make sure this is included&lt;br&gt;jcenter()&lt;br&gt;maven {&lt;br&gt;// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm&lt;br&gt;url "$rootDir/../node_modules/react-native/android"&lt;br&gt;}&lt;br&gt;}&lt;br&gt;}&lt;/pre&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--pre"&gt;Update &lt;code class="markup--code markup--li-code"&gt;android/app/build.gradle&lt;/code&gt; dependencies. My configuration looks like this&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;...&lt;br&gt;dependencies {&lt;br&gt;implementation fileTree(dir: "libs", include: ["*.jar"])&lt;br&gt;implementation "com.android.support:appcompat-v7:23.0.1"&lt;br&gt;implementation "com.facebook.react:react-native:+"&lt;br&gt;implementation project(':react-native-twitter-signin')&lt;strong class="markup--strong markup--pre-strong"&gt;/ &amp;lt;--- add this line&lt;br&gt;&lt;/strong&gt;}&lt;br&gt;apply plugin: 'com.google.gms.google-services' &lt;strong class="markup--strong markup--pre-strong"&gt;// &amp;lt;--- this should be the last line&lt;/strong&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now let’s setup &lt;code class="markup--code markup--p-code"&gt;react-native-firebase&lt;/code&gt; authentication in your application —&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Connect Firebase to your React Native app using &lt;a href="https://rnfirebase.io/" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;react-native-firebase&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;code class="markup--code markup--p-code"&gt;react-native-firebase&lt;/code&gt; is a popular package to connect React Native apps to Firebase various functionalities.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React-native-firebase also &lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/social-auth" class="markup--anchor markup--p-anchor" rel="noopener"&gt;recommends&lt;/a&gt; using &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://github.com/react-native-community/react-native-google-signin" class="markup--anchor markup--p-anchor" rel="noopener"&gt;react-native-twitter-signin&lt;/a&gt;&lt;/code&gt;for Twitter authentication, which we just used above. The &lt;code class="markup--code markup--p-code"&gt;react-native-twitter-signin&lt;/code&gt; the library allows us to login (using &lt;code class="markup--code markup--p-code"&gt;twitter&lt;/code&gt;) which returns an optional &lt;code class="markup--code markup--p-code"&gt;accessToken&lt;/code&gt; and &lt;code class="markup--code markup--p-code"&gt;authToken&lt;/code&gt;. Once we have the two tokens we need to create a credential using &lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/reference/TwitterAuthProvider#credential" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TwitterAuthProvider#credential&lt;/a&gt; and then sign in with that credential using &lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/reference/auth#signInWithCredential" class="markup--anchor markup--p-anchor" rel="noopener"&gt;auth#signInWithCredential&lt;/a&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;Install &lt;code class="markup--code markup--li-code"&gt;react-native-firebase&lt;/code&gt;package using&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;$ &lt;code class="markup--code markup--pre-code"&gt;yarn add react-native-firebase&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This installs the package, but it still needs to be connected to your android app properly&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Modify Android config files&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;If you have done the previous steps (in Step 4.4) correctly, then you only need to add these things further&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;Add following Firebase modules in dependencies in &lt;code class="markup--code markup--li-code"&gt;android/app/build.gradle&lt;/code&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;dependencies {&lt;br&gt;.....&lt;br&gt;implementation project(':react-native-firebase')&lt;br&gt;implementation "com.google.android.gms:play-services-base:17.1.0"&lt;br&gt;implementation "com.google.firebase:firebase-core:17.0.9"&lt;br&gt;implementation 'com.google.firebase:firebase-auth:19.0.0'&lt;br&gt;....&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Troubleshooting&lt;/strong&gt; — If you face issues in the above settings, visit the documentation of &lt;code class="markup--code markup--p-code"&gt;react-native-firebase&lt;/code&gt; to get detailed steps for your RN versions.&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;For older versions of React Native, in &lt;code class="markup--code markup--li-code"&gt;MainApplication.java&lt;/code&gt; you should have the following code. For my version 0.60.5, there is a need to edit &lt;code class="markup--code markup--li-code"&gt;MainApplication.java&lt;/code&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;import com.goldenowl.twittersignin.TwitterSigninPackage; // &amp;lt;---public class MainApplication extends Application implements ReactApplication {&lt;br&gt;......&lt;br&gt;@Override&lt;br&gt;protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;return Arrays.&amp;lt;ReactPackage&amp;gt;asList(&lt;br&gt;packages.add(new RNFirebaseAuthPackage());// &amp;lt;-- this needs to be in the list&lt;br&gt;) &lt;br&gt;);&lt;br&gt;}&lt;br&gt;......}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Wow, you have done well. Now, you are all set to take the taste of your own cooked food!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Code for Twitter Signin : —&lt;/strong&gt;&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Note, &lt;code class="markup--code markup--p-code"&gt;firebase.auth().signInWithCredential&lt;/code&gt; is the method used to store user credentials in the back-end.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Here,&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;TwitterKeys.TWITTER_CONSUMER_KEY = api key of the application TdewitterKeys.TWITTER_CONSUMER_SECRET = secret key of the app&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You can get both keys after creating the twitter developer’s account and registering the app on that. &lt;a href="https://developer.twitter.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;To create a developers account go here&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When you will click on the SignIn button then you will be redirected to some pages for authentication or you may say confirmation of your valid account as follow:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1 Clicked: —&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--96eiQ6Gr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2svQUI9A413tobFdhBfa7w.jpeg"&gt;&lt;br&gt;Click on login button&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2 Enter credentials : —&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--SdUxDbFJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AcjeKNW-SJkJtN2QRkaNxyw.jpeg"&gt;&lt;br&gt;Enter your Twitter accounts credentials here&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 3 Authorize app : —&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--dqlf07OL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AW8wHNQG2cfeAwwXOE9e1Ew.jpeg"&gt;&lt;br&gt;Authorize application confirmation&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Now you are in…&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--zkLKnqCw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AE14u0ZehQrMr15qXQ5UYtQ.jpeg"&gt;&lt;br&gt;User Logged in.&lt;p class="graf graf--p graf-after--figure"&gt;Now, run the app again using CLI or Android Studio, log in as usual and you’ll see that a user pops up in Firebase Users list&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--sDnr2VYm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AHztNM4l5JsVzKoKTvs_jaw.png"&gt;&lt;br&gt;User registered in Firebase via Twitter Login&lt;p class="graf graf--p graf-after--figure"&gt;In the whole setup, you may encounter a problem related to access token from react-native firebase so for that solution you would need to write &lt;strong class="markup--strong markup--p-strong"&gt;twittersdk:// &lt;/strong&gt;as callback URL in the in your attached twitter app.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p is-selected"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/RNFirebaseTwitterLogin" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;React-Native-twitter-login (android branch)&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;You have successfully&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Logged in a user using Twitter Login in React Native&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Attached the authentication to Firebase to store user credentials&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;🎉 🎉 🎉 🎉 🎉 🎉 🎉&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Firebase, further&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You can now go ahead and attach more Firebase functions like logout, silent login, user info, etc. since you have user credentials in Firebase.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Note, not all userInfo that we receive after Twitter Login gets stored in Firebase by default. If you want all the information to be stored, then you should use the FireStore database to store it, and retrieve it when required.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For more details on functions like&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;CRUD operations in Firestore&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Image Upload&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Phone authentication&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;check out &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--p-anchor" rel="noopener"&gt;this blog&lt;/a&gt;.&lt;/p&gt;
&lt;img class="graf-image" alt="Firebase phone auth, crud and image upload in react native" src="https://res.cloudinary.com/practicaldev/image/fetch/s--RIeU__9E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2ALUdW0yI8LlBNaIQ1rD3nnA.png"&gt;&lt;br&gt;Check out this blog for more details on Firebase with React Native Apps&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this blog, you learned how to implement Twitter Login in React Native apps for Android. You also learned how to attach this authentication to Firebase for better handling using back-end. We also built the app in Android and ran on a device.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/RNFirebaseTwitterLogin" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;React-Native-twitter-login (android branch)&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned about setting up React-Native Firebase social auth Twitter Login in React Native apps, here are some other topics you can look into&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Firebase — &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Integrate Firebase&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-analytics-in-react-native-app/101" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Analytics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Push notifications&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;Firebase CRUD&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How To in React Native — &lt;a href="https://enappd.com/blog/geolocation-geocoding-react-native-apps/84" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/pick-images-from-camera-gallery-in-react-native-app/78" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Redux implementation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-make-api-calls-in-react-native-apps/125" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Make API calls&lt;/a&gt; | &lt;a href="https://enappd.com/blog/navigations-in-react-native-app/124" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Navigation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-react-native-app-globalization-internationalization-and-text-to-speech/120" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Barcode &amp;amp; QR code scan&lt;/a&gt; | &lt;a href="https://enappd.com/blog/send-read-and-delete-sms-in-react-native/107" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Send &amp;amp; Read SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-vision-with-react-native/96" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Vision&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Payments — &lt;a href="https://enappd.com/blog/implement-apple-pay-in-react-native-apps/93" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/stripe-integration-in-react-native-apps-using-firebase/108" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe payments&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Authentication — &lt;a href="https://enappd.com/blog/google-login-in-react-native-android-apps-with-firebase/90" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Google Login&lt;/a&gt;| &lt;a href="https://enappd.com/blog/facebook-login-in-react-native-apps/89" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Facebook login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/react-native-firebase-crud-image-upload-and-phone-authentication/86" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Phone Auth&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-react-native-apps-using-firebase/95" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login&lt;/a&gt; | &lt;a href="https://enappd.com/blog/anonymous-login-in-react-native-apps-with-firebase/129" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous Login&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-make-stories-ui-like-instagram-and-whatsapp-in-react-native/123" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Create Instagram / Whatsapp Story Feature in React Native&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/react-native-life-cycle-hooks/79" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener noopener"&gt;React Native life cycle hooks&lt;/a&gt; | &lt;a href="https://enappd.com/blog/redux-in-react-native-app/92" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Implement Redux&lt;/a&gt; | &lt;a href="https://enappd.com/blog/async-actions-with-redux-thunk-middleware-in-react-native-apps-1/100" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Async actions with Redux&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://enappd.com/blog/guide-on-react-native-full-app/53" class="markup--anchor markup--li-anchor" rel="noopener nofollow noopener noopener noopener"&gt;Create Awesome Apps in React Native&lt;/a&gt; using Full App&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next React Native app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/react-native-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;React Native Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CF89hkbC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2AsWyEeAfCMk7ULOkLUCdSug.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>login</category>
      <category>authentication</category>
      <category>firebase</category>
    </item>
    <item>
      <title>React-Native Firebase Phone Authentication with CRUD Operations and Image Upload on storage</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Fri, 27 Mar 2020 01:11:05 +0000</pubDate>
      <link>https://dev.to/enappd/react-native-firebase-phone-authentication-with-crud-operations-and-image-upload-on-storage-4k7p</link>
      <guid>https://dev.to/enappd/react-native-firebase-phone-authentication-with-crud-operations-and-image-upload-on-storage-4k7p</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post is all about authenticating firebase phone number authentication and CRUD operations in your cool new app. In this post, you will learn&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;authenticate phone number&lt;/code&gt;in our app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to perform Firebase &lt;code class="markup--code markup--li-code"&gt;CRUD&lt;/code&gt; operations in React-Native app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to upload an image on firebase storage&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li is-selected"&gt;Before start, first you will need a React-Native app to start with, hence you can follow &lt;a href="https://facebook.github.io/react-native/docs/getting-started" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create a react-native app for beginners&lt;/strong&gt; &lt;/a&gt;and start after that from here.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/react-native-firebase-phone-auth-CRUD" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-phone-auth-CRUD&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;What is React-Native&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;React Native is a JavaScript framework for writing real, natively rendering mobile applications for iOS and Android. It’s based on React, Facebook’s JavaScript library for building user interfaces, but instead of targeting the browser, it targets mobile platforms. In other words: web developers can now write mobile applications that look and feel truly “native,” all from the comfort of a JavaScript library that we already know and love. Plus, because most of the code you write can be shared between platforms, React Native makes it easy to simultaneously develop for both Android and iOS.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Similar to React for the Web, React Native applications are written using a mixture of JavaScript and XML-Esque markup, known as JSX. Then, under the hood, the React Native “bridge” invokes the native rendering APIs in Objective-C (for iOS) or Java (for Android). Thus, your application will render using real mobile UI components, &lt;em class="markup--em markup--p-em"&gt;not&lt;/em&gt; webviews, and will look and feel like any other mobile application. React Native also exposes JavaScript interfaces for platform APIs, so your React Native apps can access platform features like the phone camera, or the user’s location.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;React Native currently supports both iOS and Android and has the potential to expand to future platforms as well. In this tutorial, we’ll cover firebase phone authentication and CRUD operations. The vast majority of the code we write will be cross-platform. And yes: you can really use React Native to build production-ready mobile applications! Some anecdota: &lt;a href="http://bit.ly/1YipO7A" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Facebook&lt;/a&gt;, &lt;a href="http://bit.ly/1PPEiZH" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Palantir&lt;/a&gt;, and &lt;a href="http://bit.ly/1PPEjNg" class="markup--anchor markup--p-anchor" rel="noopener"&gt;TaskRabbit&lt;/a&gt; are already using it in production for user-facing applications.&lt;br&gt; The fact that React Native actually renders using its host platform’s standard rendering APIs enables it to stand out from most existing methods of cross-platform application development, like Cordova or Ionic.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Existing methods of writing mobile applications using combinations of JavaScript, HTML, and CSS typically render using webviews. While this approach can work, it also comes with drawbacks, especially around performance. Additionally, they do not usually have access to the host platform’s set of native UI elements. When these frameworks do try to mimic native UI elements, the results usually “feel” just a little off; reverse-engineering all the fine details of things like animations takes an enormous amount of effort, and they can quickly become out of date.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What and why Firebase?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Firebase&lt;/strong&gt; is a mobile and web application development platform developed by Firebase Inc. in 2011, then was acquired by Google in 2014. Firebase is a toolset to “build, improve, and grow your app”. It gives you functionality like analytics, databases, messaging and crash reporting so you can move quickly and focus on your users.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Today Firebase is one of the fastest-growing platforms for application development. Some of the reasons are&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;You don’t need to write a back-end from scratch. Firebase is a ready-made back-end, with a DB attached to it. You just integrate Firebase SDK in your app and you are good to go.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It’s R-E-A-L T-I-M-E 🕺.If you are a developer, you understand the importance of a real-time back-end/database in today’s app market. Things like chat, news feeds, ratings, bookings, etc all are very easy if you factor in real-time operations&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Simple Authentication operations.The very first things required in a user-facing application is login/register operations. Firebase handles this very smoothly and with minimum coding effort. You can integrate a number of social authentication services like Facebook, Google etc. with Firebase as well.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;You get tonnes of additional features in-built e.g. AdMob, analytics, etc 😍😍&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It’s free, up to a certain usage limit. But this is pretty awesome for developers who are trying things, or making MVPs, or even for small scale app businesses. 🤑&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;In this article, we will focus on &lt;strong class="markup--strong markup--p-strong"&gt;Firebase with react-native— phone Auth with CRUD operations and image upload to firebase storage.&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Before we start I assume you have already created a project and ready to integrate the firebase in that. &lt;a href="https://enappd.com/blog/intergrate-firebase-in-react-native-app/73/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;To add firebase in your project you can just follow this tutorial and start from here.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;1. Phone Number Authentication — What and why?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Phone authentication&lt;/strong&gt; allows users to sign in to &lt;strong class="markup--strong markup--p-strong"&gt;Firebase&lt;/strong&gt; using their &lt;strong class="markup--strong markup--p-strong"&gt;phone&lt;/strong&gt; as the authenticator. An SMS message is sent to the user via their &lt;strong class="markup--strong markup--p-strong"&gt;phone&lt;/strong&gt; number containing a unique code.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Using phone authentication is a little more involved as it is a multi-step process which can differ between iOS and Android. The basic flow for phone authentication is as follows:&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;The user enters their phone number&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Firebase sends a verification code to the user’s phone&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;The user enters the verification code&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Firebase confirms that the verification code matches and signs the user in&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;To start with phone authentication you need to install &lt;code class="markup--code markup--p-code"&gt;reat-native-firebase&lt;/code&gt; by executing the following command:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;npm install --save react-native-firebase&lt;/code&gt;&lt;br&gt;yarn add react-native-firebase&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/installation/initial-setup" class="markup--anchor markup--p-anchor" rel="noopener"&gt;You can follow the official react-native-firebase link for any issue&lt;/a&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;let's start with phone authentication, as I have performed all the actions and checked on android but I will cover for the android an IOS both in this tutorial.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/android#Add-the-dependency" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;Add the dependency&lt;/strong&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Android:&lt;br&gt;&lt;/strong&gt;Add the Firebase Authentication dependency to &lt;code class="markup--code markup--p-code"&gt;android/app/build.gradle&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;dependencies {&lt;br&gt;  // ...&lt;br&gt;  implementation "com.google.firebase:firebase-auth:17.0.0"&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Then, &lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/android#Install-the-RNFirebase-Authentication-package" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Install the RNFirebase Authentication package&lt;/a&gt;&lt;br&gt;Add the &lt;code class="markup--code markup--p-code"&gt;RNFirebaseAuthPackage&lt;/code&gt; to your &lt;code class="markup--code markup--p-code"&gt;android/app/src/main/java/com/[app name]/MainApplication.java&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;// ...&lt;br&gt;import io.invertase.firebase.RNFirebasePackage;&lt;br&gt;import io.invertase.firebase.auth.RNFirebaseAuthPackage; // &amp;lt;-- Add this line&lt;br&gt;public class MainApplication extends Application implements ReactApplication {&lt;br&gt;    // ...&lt;br&gt;    @Override&lt;br&gt;    protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;      return Arrays.&amp;lt;ReactPackage&amp;gt;asList(&lt;br&gt;          new MainReactPackage(),&lt;br&gt;          new RNFirebasePackage(),&lt;br&gt;          new RNFirebaseAuthPackage() // &amp;lt;-- Add this line&lt;br&gt;      );&lt;br&gt;    }&lt;br&gt;  };&lt;br&gt;  // ...&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now you are all set to use authentications in your app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;signInWithPhoneNumber&lt;/code&gt; is a more straight-forward implementation of handling the auth flow, however, it provides less flexibility to handle the various situations which may occur.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;i&lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/phone-auth#1.-Trigger-phone-auth" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;. Trigger phone auth&lt;/a&gt;
&lt;/h4&gt;
&lt;pre class="graf graf--pre graf-after--h4"&gt;&lt;code class="markup--code markup--pre-code"&gt;firebase.auth().signInWithPhoneNumber(phoneNumber)&lt;br&gt;  .then(confirmResult =&amp;gt; // save confirm result to use with the manual verification code)&lt;br&gt;  .catch(error =&amp;gt; /error);&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;ii&lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/phone-auth#2.-Confirm-verification-code" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;. Confirm verification code&lt;/a&gt;
&lt;/h3&gt;
&lt;pre class="graf graf--pre graf-after--h3"&gt;&lt;code class="markup--code markup--pre-code"&gt;confirmResult.confirm(verificationCode)&lt;br&gt;  .then(user =&amp;gt; // User is logged in){&lt;br&gt;  .catch(error =&amp;gt; // Error with verification code);&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;iii&lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/phone-auth#3.-%5BAndroid%5D-Handle-Auto-Verification" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;. [Android] Handle Auto Verification&lt;/a&gt;
&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To handle auto verification, we need to listen to &lt;a href="https://rnfirebase.io/docs/v5.x.x/auth/reference/auth#onAuthStateChanged" class="markup--anchor markup--p-anchor" rel="noopener"&gt;auth#onAuthStateChanged&lt;/a&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;firebase.auth().onAuthStateChanged((user) =&amp;gt; {&lt;br&gt;  if (user) // user is verified and logged in&lt;br&gt;});&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Full Working Example:&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Logics here:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
Js part for phone auth
&lt;p class="graf graf--p graf-after--figure"&gt;View here:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Here I have divided my login flow into three different parts as:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;1. LoginContainer contains the logic part&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;2. LoginView Contains the View Part and&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;3. LoginStyles contains the CSS of the page&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Styles here:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
&lt;p class="graf graf--p graf-after--figure"&gt;Now you are all set to take the taste of phone authentication in your cool react-native app. Here I have used the latest react-native version 0.60.4. If you get any issues just clone my repository with the link provided above.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/react-native-firebase-phone-auth-CRUD" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-phone-auth-CRUD&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;2.CRUD Operations in react-native application&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Before you start, you need to add Firebase Firestore in your app.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/firestore/android#Add-the-dependency" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Add the dependency&lt;/a&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Add the Firebase Firestore dependency to &lt;code class="markup--code markup--p-code"&gt;android/app/build.gradle&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;dependencies {&lt;br&gt;  // ...&lt;br&gt;  implementation "com.google.firebase:firebase-firestore:19.0.0"&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/firestore/android#Install-the-RNFirebase-Firestore-package" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Install the RNFirebase Firestore package&lt;/a&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Add the &lt;code class="markup--code markup--p-code"&gt;RNFirebaseFirestorePackage&lt;/code&gt; to your &lt;code class="markup--code markup--p-code"&gt;android/app/src/main/java/com/[app name]/MainApplication.java&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;// ...&lt;br&gt;import io.invertase.firebase.RNFirebasePackage;&lt;br&gt;import io.invertase.firebase.firestore.RNFirebaseFirestorePackage; // &amp;lt;-- Add this line&lt;br&gt;public class MainApplication extends Application implements ReactApplication {&lt;br&gt;    // ...&lt;br&gt;    @Override&lt;br&gt;    protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;      return Arrays.&amp;lt;ReactPackage&amp;gt;asList(&lt;br&gt;          new MainReactPackage(),&lt;br&gt;          new RNFirebasePackage(),&lt;br&gt;          new RNFirebaseFirestorePackage() // &amp;lt;-- Add this line&lt;br&gt;      );&lt;br&gt;    }&lt;br&gt;  };&lt;br&gt;  // ...&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Then,&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;
&lt;a href="https://rnfirebase.io/docs/v5.x.x/firestore/android#Enable-multidex" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Enable multidex&lt;/a&gt;:&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Adding Firestore to your Android app requires &lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://developer.android.com/studio/build/multidex" class="markup--anchor markup--p-anchor" rel="noopener"&gt;multiDexEnabled&lt;/a&gt;&lt;/code&gt;&lt;a href="https://developer.android.com/studio/build/multidex" class="markup--anchor markup--p-anchor" rel="noopener"&gt; to be set to &lt;/a&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://developer.android.com/studio/build/multidex" class="markup--anchor markup--p-anchor" rel="noopener"&gt;true&lt;/a&gt;&lt;/code&gt; in &lt;code class="markup--code markup--p-code"&gt;android/app/build.gradle&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;//..&lt;br&gt;android {&lt;br&gt;  //..&lt;/code&gt;&lt;/pre&gt;
&lt;pre class="graf graf--pre graf-after--pre"&gt;&lt;code class="markup--code markup--pre-code"&gt;  defaultConfig {&lt;br&gt;    //..&lt;br&gt;    multiDexEnabled true  // needed for firestore:&lt;br&gt;  }&lt;br&gt;  //..&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now you're all set to store and retrieve data in firebase Firestore.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;1.Create&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You will need to add the &lt;code class="markup--code markup--p-code"&gt;createDatabse()&lt;/code&gt; method to persist an item collection in the Firestore database:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;createDatabse(){&lt;br&gt;&lt;/code&gt;firebase.firestore().collection('collection name').add({.....your data})&lt;br&gt;&lt;code class="markup--code markup--pre-code"&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;2. Read&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;You will need to add the &lt;code class="markup--code markup--p-code"&gt;readDatabse()&lt;/code&gt; method to retrieve the available item from the Firestore collection:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;readDatabse() {&lt;br&gt;return firebase.firestore.collection('&lt;/code&gt;collection name&lt;code class="markup--code markup--pre-code"&gt;').&lt;/code&gt;onSnapshot&lt;code class="markup--code markup--pre-code"&gt;((data)=&amp;gt;{console.log(data)});&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;3. Update&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Next, you need to add the &lt;code class="markup--code markup--p-code"&gt;updateDatabse()&lt;/code&gt; method to update an item data by its identifier:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;updateDatabse(docId){&lt;br&gt;firebase.firestore.doc('&lt;/code&gt;collection name&lt;code class="markup--code markup--pre-code"&gt;/' + docId).update({data to update});&lt;br&gt;} &lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Here, docId is the particular id that you get while fetching data from the Firestore, with this docId you will be able to update a particular doc from the list of docs.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;&lt;strong class="markup--strong markup--h4-strong"&gt;4. Delete&lt;/strong&gt;&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Finally, you can add the &lt;code class="markup--code markup--p-code"&gt;deleteItem()&lt;/code&gt; method to delete an item by its identifier:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;deleteItem(docId){&lt;br&gt;firebase.firestore.doc('&lt;/code&gt;collection name&lt;code class="markup--code markup--pre-code"&gt;/' + docId).delete();&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;The complete working example is here:&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
ADD and Delete with image upload
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
CREATE and DELETE
&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/react-native-firebase-phone-auth-CRUD" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-phone-auth-CRUD and image upload&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;3 Image Upload in react-native-firebase storage&lt;/h3&gt;
&lt;h3 class="graf graf--h3 graf-after--h3"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/storage/android#Add-the-dependency" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Add the dependency&lt;/a&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Add the Firebase Storage dependency to &lt;code class="markup--code markup--p-code"&gt;android/app/build.gradle&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;dependencies {&lt;br&gt;  // ...&lt;br&gt;  implementation "com.google.firebase:firebase-storage:17.0.0"&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/storage/android#Install-the-RNFirebase-Storage-package" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Install the RNFirebase Storage package&lt;/a&gt;&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Add the &lt;code class="markup--code markup--p-code"&gt;RNFirebaseStoragePackage&lt;/code&gt; to your &lt;code class="markup--code markup--p-code"&gt;android/app/src/main/java/com/[app name]/MainApplication.java&lt;/code&gt;:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;// ...&lt;br&gt;import io.invertase.firebase.RNFirebasePackage;&lt;br&gt;import io.invertase.firebase.storage.RNFirebaseStoragePackage; // &amp;lt;-- Add this line&lt;br&gt;public class MainApplication extends Application implements ReactApplication {&lt;br&gt;    // ...&lt;br&gt;    @Override&lt;br&gt;    protected List&amp;lt;ReactPackage&amp;gt; getPackages() {&lt;br&gt;      return Arrays.&amp;lt;ReactPackage&amp;gt;asList(&lt;br&gt;          new MainReactPackage(),&lt;br&gt;          new RNFirebasePackage(),&lt;br&gt;          new RNFirebaseStoragePackage() // &amp;lt;-- Add this line&lt;br&gt;      );&lt;br&gt;    }&lt;br&gt;  };&lt;br&gt;  // ...&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now you are all set to upload images on firebase Firestore and update that too. In the above gist, I have used a function &lt;code class="markup--code markup--p-code"&gt;uploadImageTask()&lt;/code&gt; . In this function, I have uploaded an image to my firebase storage and received the URL and saved that to my database. In uploadImageTask(), we have used default javascript function &lt;strong class="markup--strong markup--p-strong"&gt;decodeURI&lt;/strong&gt;(imageURl).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here, The &lt;strong class="markup--strong markup--p-strong"&gt;decodeURI()&lt;/strong&gt; function is used to decode URI generated by encodeURI&lt;strong class="markup--strong markup--p-strong"&gt;()&lt;/strong&gt;. Parameters: This function accepts single parameter complete_encoded_uri_string which holds the encoded string. Return Value: This function returns the decoded string (original string).&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
image upload to Storage
&lt;p class="graf graf--p graf-after--figure"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/installation/ios" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Here all the functions are tested on android and to make it working in IOS please follow the IOS Setup from the &lt;/a&gt;&lt;code class="markup--code markup--p-code"&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/installation/ios" class="markup--anchor markup--p-anchor" rel="noopener"&gt;react-native-firebase&lt;/a&gt;&lt;/code&gt;&lt;a href="https://rnfirebase.io/docs/v5.x.x/installation/ios" class="markup--anchor markup--p-anchor" rel="noopener"&gt; documentation.&lt;br&gt;Once you setup then you can execute all the above functions or you can clone the repository.&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;You can follow all the steps and achieve this very easily or you can clone my repo on Github&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here — &lt;/strong&gt;&lt;a href="https://github.com/mdshadman/react-native-firebase-phone-auth-CRUD" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;react-native-firebase-phone-auth-CRUD and image upload&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; &lt;em class="markup--em markup--blockquote-em"&gt;😎 😎 😎 🕺 🕺 🕺..…&lt;/em&gt;&lt;/strong&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to integrate firebase phone auth with CRUD operations and image upload to the firebase storage. Since all the integrations are somehow tricky because of react-native stability but it has great documentation, if you face any issue please do ask me on our discuss section.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;
&lt;strong class="markup--strong markup--blockquote-strong"&gt;Complete source code of this tutorial is available here —&lt;/strong&gt;&lt;a href="https://github.com/mdshadman/react-native-firebase-phone-auth-CRUD" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt; react-native-firebase-phone-auth-CRUD and image upload&lt;/strong&gt;&lt;/a&gt;
&lt;/blockquote&gt;
&lt;h3 class="graf graf--h3 graf-after--blockquote"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Firebase CRUD operations,phone auth, and image upload &lt;/strong&gt;&lt;/code&gt;in react-native, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 PayPal payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Stripe payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Apple Pay integration&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/using-geolocation-and-beacon-plugins-in-ionic-4-754b41304007" class="markup--anchor markup--li-anchor"&gt;Geolocation&lt;/a&gt; in Ionic 4&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4-95fd46be91dd" class="markup--anchor markup--li-anchor"&gt;QR Code and scanners&lt;/a&gt; in Ionic 4 and&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://medium.com/enappd/how-to-translate-in-ionic-4-globalization-internationalization-and-localization-31ec5807a8bc" class="markup--anchor markup--li-anchor"&gt;Translations in Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app/" class="markup--anchor markup--p-anchor" rel="noopener nofollow noopener noopener nofollow noopener noopener nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--IFbNjPgI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/800/1%2A2BzL8TesnBHuazHr3VA4SQ.jpeg"&gt;

</description>
      <category>reactnative</category>
      <category>firebase</category>
      <category>crud</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Ionic 4 QR Code, Barcode Scanning</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Thu, 26 Mar 2020 18:59:29 +0000</pubDate>
      <link>https://dev.to/enappd/ionic-4-qr-code-barcode-scanning-35o0</link>
      <guid>https://dev.to/enappd/ionic-4-qr-code-barcode-scanning-35o0</guid>
      <description>
&lt;h4 class="graf graf--h4 graf-after--figure"&gt;
&lt;em class="markup--em markup--h4-em"&gt;Complete source code of this tutorial is available here &lt;/em&gt;— &lt;a href="https://github.com/mdshadman/QrcodeBarcode" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Ionic 4 Qrcode Barcode&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;This post is all about scanning QR code or Barcode and creating QR code in your cool new app. In this post, you will learn&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;phonegap-plugin-barcodescanner and cordova-plugin-qrscanner&lt;/code&gt;in our app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to create &lt;code class="markup--code markup--li-code"&gt;QR Code usng&lt;/code&gt; these plugin into an ionic app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Before start, first you will need an ionic app to start with, hence you can follow &lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create an ionic app for beginners&lt;/strong&gt;&lt;/a&gt; and start after that from here.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;What is Ionic 4&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;I know most of the readers reading this blog will know what is Ionic 4, but just for the sake of beginners, I explain this in every blog.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Ionic&lt;/strong&gt; is a complete open-source SDK for hybrid mobile app development. Ionic provides tools and services for developing hybrid mobile apps using Web technologies like CSS, HTML5, and Sass. Apps can be built with these Web technologies and then distributed through native app stores to be installed on devices.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In other words — If you create native apps in Android, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Java&lt;/strong&gt;. If you create native apps in iOS, you code in &lt;strong class="markup--strong markup--p-strong"&gt;Obj-C&lt;/strong&gt; or &lt;strong class="markup--strong markup--p-strong"&gt;Swift&lt;/strong&gt;. Both of these are powerful, but complex languages. With Cordova (and Ionic) you can write a single piece of code for your app that can run on both iOS and Android (and windows!), that too with the simplicity of HTML, CSS, and JS. I’m a huge fan of Ionic and been developing Ionic apps for last 4 years.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;QR code and Barcode— What and why?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;QR code or barcode scanning is something almost every smartphone user has done at least once. We scan QR codes in supermarkets, on products in general, and oh, Amazon delivery! It’s a very handy way to recognize products instead of entering 16 digit long ID numbers etc. Similarly, reading ID numbers from Passports, etc could be very handy if you are an international hotel owner and require guests to carry passports as IDs. Or maybe you want to read off a vehicle registration number using your phone.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Here are some potential use cases for these plugins in an Ionic 4 app&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Super market app — QR/barcode scanners can provide product info to users&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Delivery app — Barcode scan can track/sign off a package&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Quick access to offers — Scan QR codes and go to a webpage&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Web authentication of a mobile app — Similar to Whatsapp Web&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Event app — Scan tickets or events passes&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;…… and many more&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;All this can now be done in Ionic apps, with the latest plugins available in Ionic 4. In this article, we will focus on such plugins.&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;Some of these plugins have been around since Ionic 1, and have been changing ever since, and some are new. So here are some of the scan plugins and functionalities you can implement with Ionic 4.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Step 1.1 Barcode Scanner&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--CI7bFOR2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AVYiPUHFLY_3GO1Zp6K-ypA.jpeg"&gt;&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--Nk4QI1hc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2ABg695WTLw3wGpigcUbqpuQ.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Barcodes and QR codes are widely used for multiple purposes like to add a link where a user doesn’t need to type the whole URL it can be easily scanned from a QR code. Barcodes can also be seen everywhere on the day to day items like eatables clothes etc, we can wimple scan these barcodes to get information like item code date of manufacturing, prices, etc.&lt;br&gt; The Barcode Scanner Plugin opens a camera view and automatically scans a barcode, returning the data back to you.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A barcode is an image consisting of a series of parallel black and white lines that, when scanned, relay information about a product. A barcode is used to automate the transfer of product information, for eg. its price, from the product to an electronic system such as a cash register. Barcodes are traditionally read by optical devices such as a barcode reader or scanner. New advances in technology allow consumers to scan barcodes with their smartphones and tablets using in-built cameras. Now you can do the same with your Ionic 4 app as well.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To start using this first you need to create an Ionic 4 project. &lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13" class="markup--anchor markup--p-anchor" rel="noopener"&gt;To create an Ionic 4 project you can follow our tutorial on How to create Ionic 4 app for beginners.&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Then install the following packages by executing this command:-&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;ionic cordova plugin add phonegap-plugin-barcodescanner&lt;br&gt;npm install @ionic-native/barcode-scanner&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now import the Barcode module in your projects &lt;code class="markup--code markup--p-code"&gt;app.module.ts&lt;/code&gt; and then inject it inside the provider, so that you can use it as a dependency injection inside the constructor and access it all over the app components.&lt;/p&gt;
app.module.ts##iframe0##&lt;h4 class="graf graf--h4 graf-after--figure"&gt;Add Button to scan a Barcode and to create a QR code&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now you are ready to use the Barcode function provided by the Ionic Plugin and get the result. Before this let us make a beautiful view to access the barcode function by clicking a button and getting the data in response.&lt;/p&gt;
home.page.html##iframe1##&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--_4ICsV6s--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2Afjhhe3tcGJ8Phtksi2YcQw.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;After this, you can simply use the following function to complete a scan process.&lt;/p&gt;
home.page.ts##iframe2##&lt;p class="graf graf--p graf-after--figure"&gt;This function will open the phone’s camera, allow you to scan a barcode, and in result will provide &lt;code class="markup--code markup--p-code"&gt;success&lt;/code&gt; or &lt;code class="markup--code markup--p-code"&gt;error&lt;/code&gt; .&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You can also pass an &lt;code class="markup--code markup--p-code"&gt;options&lt;/code&gt; object in the &lt;code class="markup--code markup--p-code"&gt;scan({options})&lt;/code&gt; function. These options are&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;preferFrontCamera&lt;/strong&gt; : true, // iOS and Android&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;showFlipCameraButton&lt;/strong&gt; : true, // iOS and Android&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;showTorchButton&lt;/strong&gt; : true, // iOS and Android&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;torchOn&lt;/strong&gt;: true, // Android, launch with the torch switched on (if   available)&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;saveHistory&lt;/strong&gt;: true, // Android, save scan history (default false)&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;prompt&lt;/strong&gt; : "Place a barcode inside the scan area", // Android&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;resultDisplayDuration&lt;/strong&gt;: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;formats&lt;/strong&gt; : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED&lt;br&gt;&lt;strong class="markup--strong markup--pre-strong"&gt;orientation&lt;/strong&gt; : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;This plugin will, of course, require a camera and file saving access on the device, so take care of that as per your device. Since iOS 10 it’s mandatory to add &lt;code class="markup--code markup--p-code"&gt;NSCameraUsageDescription&lt;/code&gt; .&lt;br&gt;&lt;code class="markup--code markup--p-code"&gt;NSCameraUsageDescription&lt;/code&gt; describes the reason that the app accesses the user's camera. When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide a usage description.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To add this entry you can use the &lt;code class="markup--code markup--p-code"&gt;edit-config&lt;/code&gt; tag in the &lt;code class="markup--code markup--p-code"&gt;config.xml&lt;/code&gt; like this:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;&amp;lt;edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge"&amp;gt;&lt;br&gt;    &amp;lt;string&amp;gt;To scan barcodes&amp;lt;/string&amp;gt;&lt;br&gt;&amp;lt;/edit-config&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Let's go and check what we get on clicking on barcode scan button&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--tgD4QsZZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2ANi1nwofw5QPfjs3BnPKS7g.jpeg"&gt;&lt;br&gt;Scanning a barcode&lt;p class="graf graf--p graf-after--figure"&gt;&lt;a href="https://github.com/mdshadman/QrcodeBarcode" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;You will get a response in return after a successful scan.&lt;br&gt; You can check the whole working Barcode application on my GitHub repo here….&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When I type in the text field my name &lt;strong class="markup--strong markup--p-strong"&gt;shadman&lt;/strong&gt; to generate a QR code of my name then the result that I got is amazing….&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--v3te2k3Q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AjdH5e3ZNxlPZDK-0lYcoOw.jpeg"&gt;&lt;br&gt;Generated QR code&lt;h3 class="graf graf--h3 graf-after--figure"&gt;Step 1.2 QRCode Scanner&lt;/h3&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--L5GRjv5m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2ANp82qM-unfv26ZtN8qsmqw.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Looks familiar? A Quick Response (QR) Code is a type of barcode that contains a matrix of dots. It can be scanned using a QR scanner or a smartphone with a built-in camera. Once scanned, software on the device converts the dots within the code into numbers or a string of characters. For example, scanning a QR code with your phone might open a URL in your phone’s web browser.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;QR codes are able to contain more information than traditional barcodes. And now your Ionic 4 app can scan QR codes very efficiently.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Come let's go to check how a QR Scanner works!&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1:- &lt;/strong&gt;Install the QR Scanner plugin by executing this command&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;ionic cordova plugin add cordova-plugin-qrscanner&lt;br&gt;npm install @ionic-native/qr-scanner&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now import the QR Scan module in your &lt;code class="markup--code markup--p-code"&gt;app.module.ts&lt;/code&gt; as we have done above for Barcode Scanner.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Add Button to scan a QRCode and to get the result&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Now you are ready to use the QRCode Scanner function provided by the Ionic Plugin and get the result. Before this let us make a beautiful view to access the QRCode function by clicking a button and getting the data in response.&lt;/p&gt;
QRCode Scanner home.pahe.html##iframe3##&lt;p class="graf graf--p graf-after--figure"&gt;The Result for the above code is:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--OQWfDM7d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2Azrh-soUJX4Xxx2r4wPC7pA.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;As we have done before for Barcode, you can simply use the Below function to complete a QR Code scan process.&lt;/p&gt;
QR Code Scanner functions##iframe4##&lt;p class="graf graf--p graf-after--figure"&gt;If camera permission was permanently denied you must use &lt;code class="markup--code markup--p-code"&gt;QRScanner.openSettings()&lt;/code&gt;method to guide the user to the settings page then they can grant the permission from there.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You can use &lt;code class="markup--code markup--p-code"&gt;QRScanner.useFrontCamera()&lt;/code&gt; to use front-camera for scanning as well.&lt;br&gt;Use &lt;code class="markup--code markup--p-code"&gt;pausePreview&lt;/code&gt; to pause the scanning while the camera is ON.&lt;br&gt;Use &lt;code class="markup--code markup--p-code"&gt;resumePreview&lt;/code&gt; to resume the scanning.&lt;br&gt;Use &lt;code class="markup--code markup--p-code"&gt;destroy&lt;/code&gt; to run &lt;code class="markup--code markup--p-code"&gt;hide&lt;/code&gt;, &lt;code class="markup--code markup--p-code"&gt;cancelScan&lt;/code&gt;, stop video capture, remove the video preview, and to deallocate as much as possible.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;For more details, you can visit &lt;a href="https://github.com/bitpay/cordova-plugin-qrscanner" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener"&gt;&lt;/a&gt;&lt;a href="https://github.com/bitpay/cordova-plugin-qrscanner"&gt;https://github.com/bitpay/cordova-plugin-qrscanner&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now when you click on the button to scan a QR code the result you will get will be amazingly like the below image but before this, it will prompt you for camera permission.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--uDj0lebx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2AGL8SmTYICBQvEkDmAzHWTA.jpeg"&gt;&lt;br&gt;Camera permission required&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--M_qO2Nys--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2A9f0RExnKmwZ45YaSAUZKwA.jpeg"&gt;&lt;br&gt;Scanning a QR Code&lt;p class="graf graf--p graf-after--figure"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;The result will be:&lt;/strong&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--A2SKbpJ3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2Ae0QC_1cOku1tvOsNVB3SjQ.jpeg"&gt;&lt;br&gt;QR Code Scanned output&lt;p class="graf graf--p graf-after--figure"&gt;Here in the result, I have scanned the QR code generated in the barcode tutorial above.&lt;a href="https://github.com/mdshadman/QrcodeBarcode/tree/QRCode" class="markup--anchor markup--p-anchor" rel="noopener"&gt; &lt;strong class="markup--strong markup--p-strong"&gt;You can follow all the steps and achieve this very easily or you can clone my repo on Github for both the plugins here and enjoy 😎 😎 😎 🕺 🕺 🕺..…&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to integrate Barcode scanner and QR Code scanner and how to generate your own QR Code using &lt;code class="markup--code markup--p-code"&gt;phonegap-plugin-barcodescanner&lt;/code&gt; in Ionic 4 apps. Since both the plugins are amazingly light and have great documentation, it is developers’ first choice when it comes to creating QR code or Scanning a barcode or QR Code.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;Complete source code of this tutorial is available here — &lt;a href="https://github.com/mdshadman/QrcodeBarcode" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Ionic 4 QRcodeBarcode&lt;/a&gt;
&lt;/h4&gt;
&lt;h3 class="graf graf--h3 graf-after--h4"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of &lt;code class="markup--code markup--p-code"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;phonegap-plugin-barcodescanner and cordova-plugin-qrscanner&lt;/strong&gt;&lt;/code&gt; in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 PayPal payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Stripe payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Apple Pay integration&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/using-geolocation-and-beacon-plugins-in-ionic-4-754b41304007" class="markup--anchor markup--li-anchor"&gt;Geolocation&lt;/a&gt; in Ionic 4&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4-95fd46be91dd" class="markup--anchor markup--li-anchor"&gt;QR Code and scanners&lt;/a&gt; in Ionic 4 and&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://medium.com/enappd/how-to-translate-in-ionic-4-globalization-internationalization-and-localization-31ec5807a8bc" class="markup--anchor markup--li-anchor"&gt;Translations in Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app/" class="markup--anchor markup--p-anchor" rel="noopener nofollow noopener noopener nofollow noopener noopener nofollow noopener noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--8c-DACQW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/600/1%2A2BzL8TesnBHuazHr3VA4SQ.jpeg"&gt;

</description>
      <category>ionic</category>
      <category>qrcode</category>
      <category>barcode</category>
      <category>scanning</category>
    </item>
    <item>
      <title>Firebase with Ionic 4 - Hosting, Auth and DB connection</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Wed, 25 Mar 2020 20:48:10 +0000</pubDate>
      <link>https://dev.to/enappd/firebase-with-ionic-4-hosting-auth-and-db-connection-7c8</link>
      <guid>https://dev.to/enappd/firebase-with-ionic-4-hosting-auth-and-db-connection-7c8</guid>
      <description>
&lt;blockquote class="graf graf--blockquote graf-after--figure"&gt;
&lt;a href="https://store.enappd.com/product/firebase-starter-kitionic4-firebase-starter/" class="markup--anchor markup--blockquote-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;Firebase Starter Kit (Ionic 4)&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--blockquote-strong"&gt;: &lt;/strong&gt;A great starter to get you started with Ionic 4 and Firebase.&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Let’s take a dive to know the paramount benefits of Firebase for your Ionic 4 App.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Firebase&lt;/strong&gt; is a mobile and web application development platform developed by Firebase Inc. in 2011, then was acquired by Google in 2014. Firebase is a toolset to “build, improve, and grow your app”. It gives you functionality like analytics, databases, messaging and crash reporting so you can move quickly and focus on your users.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Today Firebase is one of the fastest-growing platforms for application development. Some of the reasons are&lt;/p&gt;
&lt;ol class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;You don’t need to write a back-end from scratch. Firebase is a ready-made back-end, with a DB attached to it. You just integrate Firebase SDK in your app and you are good to go.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It’s R-E-A-L T-I-M-E 🕺.If you are a developer, you understand the importance of a real-time back-end/database in today’s app market. Things like chat, news feeds, ratings, bookings, etc all are very easy if you factor in real-time operations&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Simple Authentication operations.The very first things required in a user-facing application is login/register operations. Firebase handles this very smoothly and with minimum coding effort. You can integrate a number of social authentication services like Facebook, Google etc. with Firebase as well.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;You get tonnes of additional features in-built e.g. push notifications, analytics, etc 😍😍&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It’s free, up to a certain usage limit. But this is pretty awesome for developers who are trying things, or making MVPs, or even for small scale app businesses. 🤑&lt;/li&gt;
&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;In this article, we will focus on &lt;strong class="markup--strong markup--p-strong"&gt;Firebase with ionic — hosting, Auth and DB Connection. &lt;/strong&gt;Firebase has been around since Ionic 1, and has been changing ever since. So here are some of the latest plugins and functionalities you can implement using Firebase with Ionic 4.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;1. Hosting with firebase in ionic 4 —&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Hosting or deploying an ionic app on firebase is a pinch game. Not believing,&lt;br&gt;let us see how easy it is…..&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 1: —&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;We are proceeding as you don’t have any already created firebase project. Let's create one by following these steps…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;1. Go to &lt;a href="https://console.firebase.google.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;&lt;a href="https://console.firebase.google.com/"&gt;https://console.firebase.google.com/&lt;/a&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;2. Click on add a project and fill the project name input field and check the terms &amp;amp; conditions block and click on create project button.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--E8fb4MiH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AEqgF42n6El2TrB9tRMNXwA.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Now in the next step your project is ready, click on &lt;strong class="markup--strong markup--p-strong"&gt;Continue&lt;/strong&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 2: —&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, in a Terminal, install the Firebase CLI:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;npm install -g firebase-tools&lt;br&gt;&lt;/code&gt;firebase login&lt;br&gt;firebase init&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;With the Firebase CLI installed, run &lt;code class="markup--code markup--p-code"&gt;firebase init&lt;/code&gt; within your Ionic project.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now the dialog will bring up some questions and we need to select &lt;strong class="markup--strong markup--p-strong"&gt;Hosting&lt;/strong&gt; (using space, then hit enter).&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The CLI prompts:&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“Which Firebase CLI features do you want to set up for this folder?”&lt;/strong&gt; Choose “Hosting: Configure and deploy Firebase Hosting sites.”&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“Select a default Firebase project for this directory:”&lt;/strong&gt; Choose the project you created on the Firebase website.&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“What do you want to use as your public directory?”&lt;/strong&gt; Enter “www”.&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;Note: Answering these next two questions will ensure that routing, hard reload, and deep linking work in the app:&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Configure as a single-page app (rewrite all urls to /index.html)?”&lt;/strong&gt; Enter “Yes”.&lt;/p&gt;
&lt;p class="graf graf--p graf--startsWithDoubleQuote graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;“File www/index.html already exists. Overwrite?”&lt;/strong&gt; Enter “No”.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;A &lt;code class="markup--code markup--p-code"&gt;firebase.json&lt;/code&gt; config file is generated, configuring the app for deployment.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The complete &lt;code class="markup--code markup--p-code"&gt;firebase.json&lt;/code&gt; looks like:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;{&lt;br&gt;  "hosting": {&lt;br&gt;    "public": "www",&lt;br&gt;    "ignore": [&lt;br&gt;      "firebase.json",&lt;br&gt;      "&lt;strong&gt;/.*",&lt;br&gt;      "&lt;/strong&gt;/node_modules/&lt;strong&gt;"&lt;br&gt;    ],&lt;br&gt;    "rewrites": [&lt;br&gt;      {&lt;br&gt;        "source": "&lt;/strong&gt;",&lt;br&gt;        "destination": "/index.html"&lt;br&gt;      }&lt;br&gt;    ],&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;For more information about the &lt;code class="markup--code markup--p-code"&gt;firebase.json&lt;/code&gt; properties, see the &lt;a href="https://firebase.google.com/docs/hosting/full-config#section-firebase-json" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Firebase documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Step 3: —&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, build an optimized version of the app by running:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;ionic build --prod&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;step 4:-&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Last, deploy the app by running:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;firebase deploy&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;After the successful deploy, you will see a success message with two links in which one will be your project console and another will be hosting URL like below image&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--gh3dfLY7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/0%2Ag7ESbHyGDaMsvKav"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Now you can hit the hosting URL and see your app is hosted on the server.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;2. Firebase Authentication in ionic 4 —&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Ionic has made app authentications too easy for their developer, still not believing? Let us check this out here…&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You may use our &lt;a href="https://store.enappd.com/product/firebase-starter-kitionic4-firebase-starter/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Firebase Starter Kit&lt;/strong&gt;&lt;/a&gt;&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;too&lt;strong class="markup--strong markup--p-strong"&gt; &lt;/strong&gt;to get started with Firebase Authentication and many more.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BcZGiBwl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2ACWVmYtGuIZ8YMQDgh2KiVg.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Everyone wants the identity of the user to save their data securely on the cloud to give them a smooth and reliable experience on all of the users’ devices after a single login. Users don’t want to fill the data again and again on every device, so Firebase Authentication provides us these facilities here.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--x9GjgDF9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2Ay4_aEK4wpyniuTy0JZGUuQ.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;In ionic install the plugin by executing this command:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;ionic cordova plugin add cordova-plugin-firebase-authentication&lt;br&gt;npm install @ionic-native/firebase-authentication&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now Import the plugin in your component.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import { FirebaseAuthentication } from '@ionic-native/firebase-authentication/ngx';&lt;br&gt;constructor(private firebaseAuthentication: FirebaseAuthentication) { }&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;You can use the following functions to do various tasks in authentication modules.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;I. Register a User with Email and Password&lt;/h4&gt;
&lt;pre class="graf graf--pre graf-after--h4"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.createUserWithEmailAndPassword('&lt;a href="mailto:admin@enappd.com"&gt;admin@enappd.com&lt;/a&gt;', '123')&lt;br&gt;.then((res: any) =&amp;gt; console.log(res))&lt;br&gt;.catch((error: any) =&amp;gt; console.error(error));&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;II. Send Email Verification&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Initiates email verification for the current user.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.&lt;/code&gt;sendEmailVerification&lt;code class="markup--code markup--pre-code"&gt;()&lt;br&gt;.then((res: any) =&amp;gt; console.log(res))&lt;br&gt;.catch((error: any) =&amp;gt; console.error(error));&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;III. Send Password Reset Email&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Triggers the Firebase Authentication backend to send a password-reset email to the given email address, which must correspond to an existing user of your app.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.&lt;/code&gt;sendPasswordResetEmail&lt;code class="markup--code markup--pre-code"&gt;()&lt;br&gt;.then((res: any) =&amp;gt; console.log(res))&lt;br&gt;.catch((error: any) =&amp;gt; console.error(error));&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;IV. &lt;a href="https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Login with Email &amp;amp; Password&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Asynchronously signs in using an email and password.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.&lt;/code&gt;signInWithEmailAndPassword&lt;code class="markup--code markup--pre-code"&gt;('&lt;a href="mailto:test@gmail.com"&gt;test@gmail.com&lt;/a&gt;', '123')&lt;br&gt;.then((res: any) =&amp;gt; console.log(res))&lt;br&gt;.catch((error: any) =&amp;gt; console.error(error));&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;V. VerifyPhoneNumber(phoneNumber, timeout)&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Starts the phone number verification process for the given phone number.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.&lt;/code&gt;verifyPhoneNumber&lt;code class="markup--code markup--pre-code"&gt;('+&lt;/code&gt;123456789&lt;code class="markup--code markup--pre-code"&gt;', '30000')&lt;br&gt;.then((res: any) =&amp;gt; console.log(res))&lt;br&gt;.catch((error: any) =&amp;gt; console.error(error));&lt;/code&gt;&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;VI. &lt;a href="https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Sign-in anonymously&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Create and use a temporary anonymous account to authenticate with Firebase.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication.&lt;/code&gt;signInAnonymously().then(function(userInfo) {&lt;br&gt;// user is signed in&lt;br&gt;});&lt;/pre&gt;
&lt;h4 class="graf graf--h4 graf-after--pre"&gt;VII. &lt;a href="https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Google login — signInWithGoogle(idToken, accessToken)&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Uses Google’s &lt;em class="markup--em markup--p-em"&gt;idToken&lt;/em&gt; and &lt;em class="markup--em markup--p-em"&gt;accessToken&lt;/em&gt; to sign-in into firebase account. In order to retrieve those tokens follow instructions for &lt;a href="https://firebase.google.com/docs/auth/android/google-signin" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;Android&lt;/a&gt; and &lt;a href="https://firebase.google.com/docs/auth/ios/google-signin" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;iOS&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;VIII. &lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Facebook login — signInWithFacebook(accessToken)&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Uses Facebook’s &lt;em class="markup--em markup--p-em"&gt;accessToken&lt;/em&gt; to sign-in into firebase account. In order to retrieve those tokens follow instructions for &lt;a href="https://firebase.google.com/docs/auth/android/facebook-login" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;Android&lt;/a&gt; and &lt;a href="https://firebase.google.com/docs/auth/ios/facebook-login" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;iOS&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;IX. &lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--h4-anchor" rel="noopener"&gt;Twitter login — signInWithTwitter(token, secret)&lt;/a&gt;
&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Uses Twitter’s &lt;em class="markup--em markup--p-em"&gt;token&lt;/em&gt; and &lt;em class="markup--em markup--p-em"&gt;secret&lt;/em&gt; to sign-in into firebase account. In order to retrieve those tokens follow instructions for &lt;a href="https://firebase.google.com/docs/auth/android/twitter-login" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;Android&lt;/a&gt; and &lt;a href="https://firebase.google.com/docs/auth/ios/twitter-login" class="markup--anchor markup--p-anchor" rel="nofollow noopener noopener noopener noopener noopener"&gt;iOS&lt;/a&gt;.&lt;/p&gt;
&lt;h4 class="graf graf--h4 graf-after--p"&gt;X. Sign out&lt;/h4&gt;
&lt;p class="graf graf--p graf-after--h4"&gt;Signs out the current user and clears it from the disk cache.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.firebaseAuthentication&lt;/code&gt;.signOut().then(function() {&lt;br&gt;// user was signed out&lt;br&gt;});&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;3. Firebase Data Base Connection —&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;To connect your app with firebase database, at first, we need to install @angular/fire package in our app.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;By executing this command firebase will be installed in your app:-&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;npm install @angular/fire firebase --save&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Once AngularFire has been installed (the plugin that we’ll use to communicate our Ionic app with Firebase), we need to create a new project in Firebase. As we have already created a firebase project, hence go to the &lt;a href="https://console.firebase.google.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;firebase console&lt;/a&gt;, where you’ll see the following menu:&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--B7PDI0XK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2Au3vek2mv1sCPMitxHByv7Q.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Click on “&lt;strong class="markup--strong markup--p-strong"&gt;Add Firebase to your web app&lt;/strong&gt;” to see your new Firebase application’s credentials. We’ll specify these credentials to tell our Ionic application to communicate with our Firebase application.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;The next step is to add firebase to our ionic app. For this go to the app/src/environment.ts file and paste the credentials copied from the “&lt;strong class="markup--strong markup--p-strong"&gt;Add Firebase to your web app&lt;/strong&gt;” dialog.&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;export const environment = {&lt;br&gt; production: false,&lt;br&gt; firebase: {&lt;br&gt;   apiKey: "YOUR_API_KEY",&lt;br&gt;   authDomain: "YOUR_AUTH_DOMAIN",&lt;br&gt;   databaseURL: "YOUR_DATABASE_URL",&lt;br&gt;   projectId: "YOUR_PROJECT_ID",&lt;br&gt;   storageBucket: "YOUR_STORAGE_BUCKET",&lt;br&gt;   messagingSenderId: "YOUR_SENDER_ID"&lt;br&gt; }&lt;br&gt;};&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now goto firebase console and click on your project and then on the database on the left side menu.&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--n9tTGRIt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AW7vsYp-tfvLNZdsXGTH87A.jpeg"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Then create a database by filling the necessary details. Like,&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--U5LWoS4W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AJUUTUGNvHf71enKDqorx9A.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;After creating a database you can select real-time database&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--JDmrhlWj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AD67_nDTMM3xIXp7yGpUb4w.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;After selecting Real-time database, you will get the screen like,&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--gwGblowU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/1%2AcakZNAoM0VDe9otDBJcq1w.png"&gt;&lt;p class="graf graf--p graf-after--figure"&gt;Before starting,&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;import { AngularFirestoreModule } from ‘&lt;a href="http://twitter.com/angular/fire" class="markup--anchor markup--blockquote-anchor" title="Twitter profile for @angular/fire" rel="noopener"&gt;@angular/fire&lt;/a&gt;/firestore’; in your app.module.ts. So that you can access this in your components.&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;Now we are ready to start CRUD(Create, Read, Update, Delete) operations with firebase and ionic. We are going to see all these operations one by one:&lt;/p&gt;
&lt;blockquote class="graf graf--blockquote graf-after--p"&gt;import { AngularFirestoreCollection, AngularFirestore } from ‘@angular/fire/firestore’; in your page.ts&lt;/blockquote&gt;
&lt;p class="graf graf--p graf-after--blockquote"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;and in the constructor inject:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;constructor(&lt;code class="markup--code markup--pre-code"&gt;private firestore&lt;/code&gt;: AngularFirestore) { }&lt;/pre&gt;
&lt;ol class="postList"&gt;&lt;li class="graf graf--li graf-after--pre"&gt;&lt;strong class="markup--strong markup--li-strong"&gt;Create&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p class="graf graf--p graf-after--li"&gt;You will need to add the &lt;code class="markup--code markup--p-code"&gt;createDatabse()&lt;/code&gt; method to persist an item collection in the Firestore database:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;createDatabse(items: Item){&lt;br&gt;    return this.firestore.collection('itemsList').add(items);&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;2. Read&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;You will need to add the &lt;code class="markup--code markup--p-code"&gt;readDatabse()&lt;/code&gt; method to retrieve the available item from the Firestore collection:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;readDatabse() {&lt;br&gt;    return this.firestore.collection('policies').snapshotChanges();&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;3. Update&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p is-selected"&gt;Next, you need to add the &lt;code class="markup--code markup--p-code"&gt;updateDatabse()&lt;/code&gt; method to update an item data by its identifier:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;updateDatabse(items: Item){&lt;br&gt;    delete items.id;&lt;br&gt;    this.firestore.doc('itemsList/' + items.id).update(items);&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;4. Delete&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Finally, you can add the &lt;code class="markup--code markup--p-code"&gt;deleteItem()&lt;/code&gt; method to delete an item by its identifier:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;deleteItem(itemId: string){&lt;br&gt;    this.firestore.doc('itemsList/' + itemId).delete();&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;a href="https://store.enappd.com/product/ionic4-firebase-starter/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;You can find the fully-functioning ionic -firebase starter kit with lots of more features only by clicking here….&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion:&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this tutorial, we have learned how to deploy our ionic app on firebase using firebase hosting method, then we got to know what are the various tasks in firebase authentications modules with the ionic app and how to achieve those?&lt;br&gt;At last but not least we got to know how we can connect our firebase database with our ionic application very easily and we understood the methods and functions of firebase CRUD operation in the ionic application. Firebase provides us these facilities for free up to a limit. Firebase is truly a great match for modern-day mobile apps and is really developer-friendly.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of Local Notifications in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Ionic 4 Payment Gateways — &lt;a href="https://enappd.com/blog/ionic-4-stripe-payment-integration-with-firebase-for-apps-and-pwa/17" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Stripe&lt;/a&gt; | &lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="noopener"&gt;PayPal&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Apple Pay&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-integrate-razorpay-in-ionic-4-apps-and-pwa/20" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RazorPay&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Charts with — &lt;a href="https://enappd.com/blog/ionic-4-charts-using-google-charts/66" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google Charts &lt;/a&gt;| &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-3/60" class="markup--anchor markup--li-anchor" rel="noopener"&gt;HighCharts&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-charts-in-ionic-4-apps-and-pwa-part-2/54" class="markup--anchor markup--li-anchor" rel="noopener"&gt;d3.js&lt;/a&gt; | &lt;a href="https://enappd.com/blog/charts-in-ionic-4-apps-and-pwa-part-1/52" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Chart.js&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Social Logins — &lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook&lt;/a&gt; | &lt;a href="https://enappd.com/blog/google-login-in-ionic-4-apps-using-firebase/39" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Google&lt;/a&gt; | &lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Authentications — &lt;a href="https://enappd.com/blog/email-authentication-with-firebase-in-ionic-4/38" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Via Email&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-anonymous-login-in-ionic-4/37" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Anonymous&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Features — &lt;a href="https://enappd.com/blog/using-geolocation-geocoding-and-reverse-geocoding-in-ionic-4/45" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Geolocation&lt;/a&gt; | &lt;a href="https://enappd.com/blog/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4/9" class="markup--anchor markup--li-anchor" rel="noopener"&gt;QR Code reader &lt;/a&gt;| &lt;a href="https://enappd.com/blog/best-fitness-plugins-for-ionic-4-how-to-use-pedometer/15" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Pedometer&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Media in Ionic 4 — &lt;a href="https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Audio&lt;/a&gt; | &lt;a href="https://enappd.com/blog/adding-video-player-in-ionic-4-app/64" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Video&lt;/a&gt; | &lt;a href="https://enappd.com/blog/image-picker-in-ionic-4-app/67" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Picker&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-add-image-cropper-in-ionic-4-app/68" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Image Cropper&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 Essentials — &lt;a href="https://enappd.com/blog/ionic-4-save-and-retrieve-data-locally-on-device/59" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Native Storage&lt;/a&gt; | &lt;a href="https://enappd.com/blog/how-to-translate-in-ionic-4-globalization-internationalization-and-localization/11" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Translations&lt;/a&gt; | &lt;a href="https://enappd.com/blog/rtl-right-to-left-use-in-ionic-4/50" class="markup--anchor markup--li-anchor" rel="noopener"&gt;RTL&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 messaging — &lt;a href="https://enappd.com/blog/implement-ionic-4-firebase-push/34" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Firebase Push&lt;/a&gt; | &lt;a href="https://enappd.com/blog/automatically-read-sms-in-ionic-4-apps/42" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Reading SMS&lt;/a&gt; | &lt;a href="https://enappd.com/blog/local-notifications-in-ionic-4/69" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Local notification&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Ionic 4 with Firebase — &lt;a href="https://enappd.com/blog/how-to-integrate-firebase-in-ionic-4-apps/23" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Basics&lt;/a&gt; | &lt;a href="https://enappd.com/blog/firebase-cloud-functions-in-ionic-4-complete-guide/32" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Cloud functions&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;If you need a base to start your next Ionic 4 app, you can make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;img class="graf-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--LAite3J---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/720/0%2A1ArpKyhiDHZnevwB.jpeg"&gt;

</description>
      <category>ionic</category>
      <category>firebase</category>
      <category>hosting</category>
      <category>database</category>
    </item>
    <item>
      <title>Ionic 4 - Save and Retrieve Data using Native storage and SQLite</title>
      <dc:creator>Shadman</dc:creator>
      <pubDate>Wed, 25 Mar 2020 20:35:07 +0000</pubDate>
      <link>https://dev.to/enappd/ionic-4-save-and-retrieve-data-using-native-storage-and-sqlite-274l</link>
      <guid>https://dev.to/enappd/ionic-4-save-and-retrieve-data-using-native-storage-and-sqlite-274l</guid>
      <description>
&lt;p class="graf graf--p graf-after--figure"&gt;This post is all about saving data locally in your cool new app. In this post, you will learn&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;How to implement &lt;code class="markup--code markup--li-code"&gt;cordova-sqlite-storage &lt;/code&gt;in our app.&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;How to integrate &lt;code class="markup--code markup--li-code"&gt;native-storage&lt;/code&gt; into an ionic app.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;Before start, first you will need an ionic app to start with, hence you can follow &lt;a href="https://enappd.com/blog/how-to-create-an-ionic-4-app-for-beginners/13" class="markup--anchor markup--p-anchor" rel="noopener"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;how to create an ionic app for beginners&lt;/strong&gt;&lt;/a&gt; and start after that from here.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;1. Storage — What and why?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Storage is an easy way to store key/value pairs and JSON objects. Storage uses a variety of storage engines underneath, picking the best one available depending on the platform.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;When running in a native app context, Storage will prioritize using SQLite, as it’s one of the most stable and widely used file-based databases, and avoids some of the pitfalls of things like local storage and IndexedDB, such as the OS deciding to clear out such data in low disk-space situations.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;As every application needs their data to store in local storage or cache for fast loading or for any purpose, we have a nice solution for that in ionic as @ionic/storage.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;To start with first execute the following command in your terminal:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;ionic cordova plugin add cordova-sqlite-storage&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, install the package (comes by default for Ionic apps &amp;gt; Ionic V1):&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;npm install --save @ionic/storage&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Next, add it to the imports list in your &lt;code class="markup--code markup--p-code"&gt;NgModule&lt;/code&gt; declaration (for example, in &lt;code class="markup--code markup--p-code"&gt;src/app/app.module.ts&lt;/code&gt;):&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p is-selected"&gt;&lt;code class="markup--code markup--pre-code"&gt;import { IonicStorageModule } from '@ionic/storage';&lt;br&gt;@NgModule({&lt;br&gt;  declarations: [&lt;br&gt;    // ...&lt;br&gt;  ],&lt;br&gt;  imports: [&lt;br&gt;    BrowserModule,&lt;br&gt;    IonicModule.forRoot(MyApp),&lt;br&gt;    IonicStorageModule.forRoot()&lt;br&gt;  ],&lt;br&gt;  bootstrap: [IonicApp],&lt;br&gt;  entryComponents: [&lt;br&gt;    // ...&lt;br&gt;  ],&lt;br&gt;  providers: [&lt;br&gt;    // ...&lt;br&gt;  ]&lt;br&gt;})&lt;br&gt;export class AppModule {}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now create a service for ionic storage functions by executing this command:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;ionic generate service storage&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now in your generated storage service add the following codes to use wherever needed in the application:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;import { Injectable } from '@angular/core';&lt;br&gt;import { Storage } from '@ionic/storage';&lt;br&gt;@Injectable({&lt;br&gt;providedIn: 'root'&lt;br&gt;})&lt;br&gt;export class StorageService {&lt;br&gt;constructor(public storage: Storage)&lt;br&gt;{ console.log('Your storage provider is working here !'); }&lt;br&gt;// set a key/value&lt;br&gt;async set(key: string, value: any): Promise&amp;lt;any&amp;gt; {&lt;br&gt;try {&lt;br&gt;const result = await this.storage.set(key, value);&lt;br&gt;console.log('set string in storage: ' + result);&lt;br&gt;return true;&lt;br&gt;} catch (reason) {&lt;br&gt;console.log(reason);&lt;br&gt;return false;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;// to get a key/value pair&lt;br&gt;async get(key: string): Promise&amp;lt;any&amp;gt; {&lt;br&gt;try {&lt;br&gt;const result = await this.storage.get(key);&lt;br&gt;console.log('storageGET: ' + key + ': ' + result);&lt;br&gt;if (result != null) {&lt;br&gt;return result;&lt;br&gt;}&lt;br&gt;return null;&lt;br&gt;} catch (reason) {&lt;br&gt;console.log(reason);&lt;br&gt;return null;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;// set a key/value object&lt;br&gt;async setObject(key: string, object: Object) {&lt;br&gt;try {&lt;br&gt;const result = await this.storage.set(key, JSON.stringify(object));&lt;br&gt;console.log('set Object in storage: ' + result);&lt;br&gt;return true;&lt;br&gt;} catch (reason) {&lt;br&gt;console.log(reason);&lt;br&gt;return false;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;// get a key/value object&lt;br&gt;async getObject(key: string): Promise&amp;lt;any&amp;gt; {&lt;br&gt;try {&lt;br&gt;const result = await this.storage.get(key);&lt;br&gt;if (result != null) {&lt;br&gt;return JSON.parse(result);&lt;br&gt;}&lt;br&gt;return null;&lt;br&gt;} catch (reason) {&lt;br&gt;console.log(reason);&lt;br&gt;return null;&lt;br&gt;}&lt;br&gt;}&lt;br&gt;// remove a single key value:&lt;br&gt;remove(key: string) {&lt;br&gt;    this.storage.remove(key);&lt;br&gt;}&lt;br&gt;//  delete all data from your application:&lt;br&gt;clear() &lt;br&gt;{&lt;br&gt;   this.storage.clear();&lt;br&gt;}&lt;br&gt;}&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now create a page using the ionic command:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;ionic generate page storagedemo&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;In &lt;code class="markup--code markup--p-code"&gt;storagedemo.page.ts&lt;/code&gt; inject &lt;code class="markup--code markup--p-code"&gt;storage&lt;/code&gt; in constructor&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;code class="markup--code markup--p-code"&gt;constructor(public storageService: StorageService) { }&lt;/code&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Now let’s save and get strings in your constructor. For simplicity, we’ll just output the result in the &lt;strong class="markup--strong markup--p-strong"&gt;console&lt;/strong&gt;.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;i. Save String:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.&lt;code class="markup--code markup--pre-code"&gt;storageService&lt;/code&gt;.set('user_name', 'Shadman').then(result =&amp;gt; {&lt;br&gt;console.log('Data is saved');&lt;br&gt;}).catch(e =&amp;gt; {&lt;br&gt;console.log("error: " + e);&lt;br&gt;});&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;ii. Get String:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.&lt;code class="markup--code markup--pre-code"&gt;storageService&lt;/code&gt;.get('user_name').then(result =&amp;gt; {&lt;br&gt;if (result != null) {&lt;br&gt;console.log('Username: '+ result);&lt;br&gt;}&lt;br&gt;}).catch(e =&amp;gt; {&lt;br&gt;console.log('error: '+ e);&lt;br&gt;// Handle errors here&lt;br&gt;});&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;iii. Save an Object:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.&lt;code class="markup--code markup--pre-code"&gt;storageService&lt;/code&gt;.setObject('person', {name : 'Shadman', age : 26});&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;iv. Get an Object:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.&lt;code class="markup--code markup--pre-code"&gt;storageService&lt;/code&gt;.getObject('person').then(result =&amp;gt; {&lt;br&gt;if (result != null) {&lt;br&gt;console.log('Person: '+ result);&lt;br&gt;}&lt;br&gt;}).catch(e =&amp;gt; {&lt;br&gt;console.log('error: ', e);&lt;br&gt;});&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;v. You can remove any value associated with the key:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.storageService.remove('user_name');&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;vi. You can delete/clear all the data from your application:&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;this.storageService.clear();&lt;/pre&gt;
&lt;h3 class="graf graf--h3 graf-after--pre"&gt;2. Ionic native-storage — What and Why?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;This plugin is created because of the non-persistent property of LocalStorage in the WebView of Android and iOS. In iOS stored data from LocalStorage can be removed by the OS, when running out of memory.&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;When to use the plugin:&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Simple: Uniform and convenient way of organizing, storing, and accessing the data&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Fast: Less than 1 millisecond to save or retrieve an object (in general)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Persistence: Save data over multiple sessions, i.e. holds the data until the application is removed from the device&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;Small data: Store small amounts of persistent data (less than a few hundred kilobytes)&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;It is possible to store more than a few megabytes, but that’s not the intended usage of the plugin.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;When not to use the plugin:&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;Storing and retrieving files can be done by means of the &lt;a href="https://github.com/apache/cordova-plugin-file" class="markup--anchor markup--li-anchor" rel="noopener"&gt;file plugin&lt;/a&gt;
&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;For storing many objects please consider trying a database-based strategy, for instance: WebSQL and &lt;a href="https://github.com/litehelpers/Cordova-sqlite-storage" class="markup--anchor markup--li-anchor" rel="noopener"&gt;SQLite plugin&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;
&lt;a href="https://ionicframework.com/docs/native/native-storage#installation" class="markup--anchor markup--h3-anchor" rel="noopener"&gt;Installation&lt;/a&gt;:&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Execute the following command in your terminal:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;ionic cordova plugin add cordova-plugin-nativestoragenpm install @ionic-native/native-storage&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;After installation completes, import &lt;code class="markup--code markup--p-code"&gt;NativeStorage &lt;/code&gt;module in your &lt;code class="markup--code markup--p-code"&gt;app.module.ts&lt;/code&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;import { NativeStorage } from '@ionic/storage';&lt;br&gt;@NgModule({&lt;br&gt;  declarations: [&lt;br&gt;    // ...&lt;br&gt;  ],&lt;br&gt;  imports: [&lt;br&gt;    BrowserModule,&lt;br&gt;    IonicModule.forRoot(MyApp),&lt;br&gt;    NativeStorageModule.forRoot()&lt;br&gt;  ],&lt;br&gt;  bootstrap: [IonicApp],&lt;br&gt;  entryComponents: [&lt;br&gt;    // ...&lt;br&gt;  ],&lt;br&gt;  providers: [&lt;br&gt;    // ...&lt;br&gt;  ]&lt;br&gt;})&lt;br&gt;export class AppModule {}&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now you are totally set to use this in your app’s components/pages as:&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Storing values&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.nativeStorage.setItem('myitem', {property: 'value', anotherProperty: 'anotherValue'})&lt;br&gt;  .then(&lt;br&gt;    () =&amp;gt; console.log('Stored item!'),&lt;br&gt;    error =&amp;gt; console.error('Error storing item', error)&lt;br&gt;  );&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Retrieving values&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;&lt;code class="markup--code markup--pre-code"&gt;this.nativeStorage.getItem('myitem')&lt;br&gt;  .then(&lt;br&gt;    data =&amp;gt; console.log(data),&lt;br&gt;    error =&amp;gt; console.error(error)&lt;br&gt;  );&lt;/code&gt;&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Retrieving all keys&lt;/strong&gt;&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;storageService.keys().then(&lt;br&gt;data =&amp;gt; console.log(data),&lt;br&gt;error =&amp;gt;{console.log(error);}&lt;br&gt;);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;Removing values&lt;/strong&gt;&lt;/p&gt;
&lt;p class="graf graf--p graf-after--p"&gt;Removing a single variable:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;NativeStorage.remove("reference_to_value",&amp;lt;success-callback&amp;gt;, &amp;lt;error-callback&amp;gt;);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Removing all stored variables:&lt;/p&gt;
&lt;pre class="graf graf--pre graf-after--p"&gt;NativeStorage.clear(&amp;lt;success-callback&amp;gt;, &amp;lt;error-callback&amp;gt;);&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;&lt;strong class="markup--strong markup--p-strong"&gt;iOS-specific features&lt;/strong&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--p"&gt;App Groups (share data between apps) First the suite name must be provided before accessing and retrieving data.&lt;/li&gt;&lt;/ul&gt;
&lt;pre class="graf graf--pre graf-after--li"&gt;NativeStorage.initWithSuiteName("suitename");&lt;/pre&gt;
&lt;p class="graf graf--p graf-after--pre"&gt;Now at last but not least, you’re all set to play with ionic/storage and ionic/native storage.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Conclusion:&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;In this post, we learned how to implement ionic SQLite-storage and ionic native-storage, we got to know the difference and the use of these two in ionic 4 application. I hope this post made your confusions clear that what is ionic-storage and why to use, as same for the native-storage.&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;NEED FREE IONIC 4 STARTERS?&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;You can also find free Ionic 4 starters on our website &lt;a href="http://enappd.com/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;enappd.com&lt;/a&gt;&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://store.enappd.com/product/free-chat-themes-ionic4/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Free Chat Themes Starter for Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://store.enappd.com/product/ionic4-firebase-starter/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Free Ionic 4 — Firebase Starter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="graf graf--p graf-after--li"&gt;You can also make your next awesome app using &lt;a href="https://store.enappd.com/product/ionic-4-full-app/" class="markup--anchor markup--p-anchor" rel="noopener"&gt;Ionic 4 Full App&lt;/a&gt;&lt;/p&gt;
&lt;h3 class="graf graf--h3 graf-after--p"&gt;Next Steps&lt;/h3&gt;
&lt;p class="graf graf--p graf-after--h3"&gt;Now that you have learned the implementation of SQLite-storage and native -storage for storing or caching values in Ionic 4, you can also try&lt;/p&gt;
&lt;ul class="postList"&gt;
&lt;li class="graf graf--li graf-after--p"&gt;&lt;a href="https://enappd.com/blog/spotify-like-music-in-ionic-4-apps/48/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Play Spotify style mucic in ionic 4.&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/ionic-4-paypal-payment-integration-for-apps-and-pwa/16" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 PayPal payment integration — for Apps and PWA&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/how-to-integrate-apple-pay-in-ionic-4-apps/21" class="markup--anchor markup--li-anchor" rel="nofollow noopener noopener noopener noopener noopener noopener noopener noopener"&gt;Ionic 4 Apple Pay integration&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/twitter-login-in-ionic-4-apps-using-firebase/24" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Twitter login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/facebook-login-in-ionic-4-apps-using-firebase/25" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Facebook login in Ionic 4 with Firebase&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://enappd.com/blog/implement-google-vision-in-ionic-4/43/" class="markup--anchor markup--li-anchor" rel="noopener"&gt;How to implement google vision in Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;
&lt;a href="https://medium.com/enappd/qr-code-scanning-and-optical-character-recognition-ocr-in-ionic-4-95fd46be91dd" class="markup--anchor markup--li-anchor"&gt;QR Code and scanners&lt;/a&gt; in Ionic 4 and&lt;/li&gt;
&lt;li class="graf graf--li graf-after--li"&gt;&lt;a href="https://medium.com/enappd/how-to-translate-in-ionic-4-globalization-internationalization-and-localization-31ec5807a8bc" class="markup--anchor markup--li-anchor"&gt;Translations in Ionic 4&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 class="graf graf--h3 graf-after--li"&gt;References&lt;/h3&gt;
&lt;ul class="postList"&gt;&lt;li class="graf graf--li graf-after--h3 graf--trailing"&gt;&lt;a href="https://ionicframework.com/docs" class="markup--anchor markup--li-anchor" rel="noopener"&gt;Ionic documentation&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;

</description>
      <category>ionic</category>
      <category>storage</category>
      <category>data</category>
      <category>retrieve</category>
    </item>
  </channel>
</rss>
