<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[F22 Labs - Medium]]></title>
        <description><![CDATA[We specialise in working with ‘idea stage’ entrepreneurs to shape your idea into a product, and help you get feedback from users. - Medium]]></description>
        <link>https://medium.com/f22labs?source=rss----5254d95312dc---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>F22 Labs - Medium</title>
            <link>https://medium.com/f22labs?source=rss----5254d95312dc---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:00:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/f22labs" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[WebHook integration with Stripe Payment Intents]]></title>
            <link>https://medium.com/f22labs/webhook-integration-with-stripe-payment-intents-fd441011dace?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/fd441011dace</guid>
            <category><![CDATA[stripe]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[webhooks]]></category>
            <category><![CDATA[payment-gateway]]></category>
            <dc:creator><![CDATA[Pradeep Kumar]]></dc:creator>
            <pubDate>Mon, 18 May 2020 03:23:38 GMT</pubDate>
            <atom:updated>2020-04-15T17:58:52.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*0TjqQsZ2eCEGSRyN58Levw.gif" /><figcaption>webhook</figcaption></figure><p>You may have heard about Webhooks when integrating payment providers Stripe, Razorpay, Dwolla, etc in your application. I was working on one of the rails applications and had to integrate Stripe payment in that. So I read about webhook, what it does and integrated with my application.</p><p>In this blog, I am going to cover the following things:</p><ol><li>What is a webhook?</li><li>Webhook integration with Stripe payment intent.</li></ol><h3>1. What is a WebHook?</h3><p>A WebHook is an HTTP callback: an HTTP POST that occurs when something happens. With all APIs, there’s a request followed by a response. Even for webhook, the request is made by the payment provider. just the difference is here request is initiated by another server instead of a client-side browser.</p><h3>2. WebHook integration with Stripe Payment Intent</h3><p>To use a webhook, you’ll have to register a URL with the Payment Gateway. This URL is a place within your application that will accept the data and process it. Whenever any change to your payment application happens eg: a customer creating a transfer, adding a new bank account, withdrawing funds, etc., the Payment provider will notify your application server using this webhook endpoint present in your server. It is generally a good practice to record all requests sent to this endpoint by the payment provider and process only the topics that are of application’s interests such as you may only have to process a topic <em>customer_bank_transfer_completed</em> or <em>customer_bank_transfer_failed</em> to mark your payment record with complete / failed.</p><p>In my case, I was using the <a href="https://stripe.com/docs/payments/payment-intents">Stripe payment Intent API</a> and integrated the webhook for it.<br>Here are the following steps.</p><p>1. Create a model called <em>Webhook</em> and add attributes based on your requirements (like <em>event</em>, <em>event_type</em>).<br>2. Create a controller called <em>webhook_controllers.rb</em><br>3. Write an action called <em>create.</em><br>4. Add route in <strong><em>config/routes.rb</em></strong> file</p><pre>resources :webhooks, only :create</pre><p>The <em>migration</em> will look like:</p><pre>class CreateWebhooks &lt; ActiveRecord::Migration[6.0]<br>  def change<br>    create_table :webhooks do |t|<br>      t.json :event<br>      t.string :event_type<br>      t.timestamps<br>    end<br>  end<br>end</pre><p>Paste the following code inside <strong><em>webhook_controllers.rb</em></strong></p><pre>def create<br>      payload = request.body.read<br>      begin<br>        event = Stripe::Webhook.construct_event(<br>          payload, signature_header, endpoint_secret<br>        )<br>      rescue JSON::ParserError =&gt; e<br>        # Invalid payload<br>        render json: {success: false, message: &quot;Invalid payload&quot;}, status: 400 and return<br>      rescue Stripe::SignatureVerificationError =&gt; e<br>        # Invalid signature<br>        render json: {success: false, message: &quot;Invalid signature&quot;}, status: 400 and return<br>      end</pre><pre>json_data = JSON.parse(event.to_json)<br>      stripe_webhook = Webhook.create!(event: json_data, event_type: json_data[&quot;type&quot;])<br>      render json: {success: true, message: &quot;successfully stored&quot;}, status: :ok<br>  end</pre><pre>private</pre><pre>def signature_header<br>      request.env[&#39;HTTP_STRIPE_SIGNATURE&#39;]<br>  end</pre><pre>def endpoint_secret<br>       Rails.application.credentials.stripe.dig(:webhook_endpoint_secret)<br>  end</pre><p>You will find <strong>endpoint_secret</strong> in the stripe dashboard. First, log in to the dashboard, click on test mode then go to <em>Developers</em> <em>-&gt;</em> <em>Webhooks</em> <em>-&gt;</em> <em>signing secret</em> as shown in the image. Click to reveal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_ulFOFL9omasibboq7ayg.png" /><figcaption>endpoint secret image</figcaption></figure><p>Add your endpoint to the stripe dashboard. suppose your URL is <a href="https://www.mydomain.com/webhooks">https://mydomain.com/webhooks</a> and select the event that you want to receive data for. You can see in the below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bcRrEJQGfsgppuTFJ1RRgA.png" /><figcaption>Add Webhook endpoint image.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQfX6LC95j9KecygesdoMw.png" /><figcaption>selected events image</figcaption></figure><p>After setting up everything, you can send a test webhook and test your endpoint whether it is working perfectly or not.</p><h3>Conclusion</h3><p>And that’s it! Did this work for you? Please leave any questions and comments below!</p><p>Thank you for reading!</p><p>If you found this article helpful, 👏👏👏</p><p><strong>References</strong>:-</p><p><a href="https://stripe.com/docs/payments/payment-intents">stripe payment intent docs</a>.</p><p><a href="https://stripe.com/docs/webhooks">stripe webhook</a></p><p><a href="https://stripe.com/docs/payments/payment-intents/verifying-status#webhooks">stripe payment intent webhook</a>.</p><p><a href="https://stripe.com/docs/api/events/types">types of event in stripe API</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd441011dace" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/webhook-integration-with-stripe-payment-intents-fd441011dace">WebHook integration with Stripe Payment Intents</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Streaming Videos With AWS Elastic Transcoder My Story!]]></title>
            <link>https://medium.com/f22labs/streaming-videos-with-aws-elastic-transcoder-my-story-a88411c8ef8?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/a88411c8ef8</guid>
            <category><![CDATA[elastic-transcoder]]></category>
            <category><![CDATA[vod]]></category>
            <category><![CDATA[hls]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[drm]]></category>
            <dc:creator><![CDATA[Chandrachudh K]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 06:01:28 GMT</pubDate>
            <atom:updated>2020-04-27T06:01:28.090Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YDyidOH8HBUX2o_dMxedjg.jpeg" /><figcaption>\Photo by <a href="https://unsplash.com/photos/jvJZY0olJvE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Parker Byrd</a> on <a href="https://unsplash.com/search/photos/streaming?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>This is my version of how to stream videos with AWS at minimal cost and decent security for the content. We at <a href="http://f22labs.com/">F22 Labs</a> recently finished a client project, which is an on-demand video service.</p><p>We wanted to ensure the following :</p><ul><li>That the content is not scrapable/downloadable by extracting the video URL.</li><li>Enable Dynamic bit rate play, so that the streaming bit rate would automatically toggle based on the internet connection strength.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vNRd1VSYBdz_8zNP8JTwEA.gif" /></figure><p>Before we dive in, here’s some context. This is my first time directly playing with the AWS console. I have written several iOS components that use AWS APIs, but this is my first time setting up an entire AWS service from scratch for a project. Being a developer who has only worked in iOS and other frontend technologies, I really felt like a monkey who has got a diamond in his hand! I struggled hard, luckily my team and our client were encouraging — lucky me!</p><p>Here’s the basic version of how not to set up video streaming :</p><p>Store the videos in 2 S3 Buckets. One will store the original .mp4 videos and the other stores the output files which can be streamed. Bear with me here, I will explain what the output files are and how to generate them in a bit.</p><p>When you put a .mp4 video directly to S3 and use the S3 URL to stream the video, you will be disappointed. The trial iOS app I built to test this started downloading the entire video in one shot it took about a minute to download the 2 min video file and started playing it. This is not the expected behavior we wanted. But this was good to know! Then what is the solution for this?</p><p>This failed because :</p><ul><li>It did not stream, but instead downloaded the entire file in one shot.</li><li>Was not secure, as anyone that sniffs the traffic can get the .mp4 URLs and can download them.</li></ul><h4>Here comes the savior: HTTP Live Streaming — HLS</h4><p>This is an amazing protocol for VOD (Video On Demand).</p><p>Here’s what HLS does :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2bTwhprLRdZz1wTk4yBVig.png" /></figure><ul><li>It allows you to breakdown your video into smaller segments (of say 10 seconds). A segment is the smallest length of video that would be played without buffering.</li><li>Multiple copies of the segmented video are created with different bitrates to allow for download based on the internet speed of the consumer.</li><li>A playlist is a compilation of the different smaller segments. There is one playlist per bitrate. Example: We will have 1 playlist for 1080p, 1 for 360p and so on. These playlists are .m3u8 files.</li><li>Then there is another grand .m3u8 (playlist) file, that contains all the other .m3u8 files. This is how the player toggles between different bitrate video segments based on internet strength.</li></ul><h3><strong>How to Create HLS Videos in AWS</strong></h3><p>AWS has the following services that will help us do it :</p><ul><li>AWS Media Convert</li><li>AWS Elastic Transcoder</li></ul><h4>AWS Media Convert:</h4><p>Using AWS Media Convert, you can create multiple playlists with different bit rates. But you need to write additional code to create the containing .m3u8 file that references the individual bitrate .m3u8 files.</p><p>And this allows to stream the video at dynamic bitrates depending on the strength of the internet connection, but it’s not secure. On video play, if we sniff the requests to get the video URL, using the URL, the video can be downloaded.</p><p>There is a way, however, to enable Digital Rights Management (DRM) while making the output files from the Media Convert. AWS provides us with the option to enable this feature but requires 3rd party services to encrypt the videos. We were looking for a way to achieve our requirements completely through AWS, and that’s when we tried our next service.</p><h4>Elastic Transcoder:</h4><p>Here’s how we achieved both our requirements with Elastic Transcoder :</p><p><strong>Step 1</strong>: Login to AWS console and from the services menu select S3.</p><p><strong>Step 2</strong>: In S3 create 3 buckets with the preferred region. 1) <strong>Input bucket</strong>, 2) <strong>Output bucket</strong> &amp; 3) <strong>Image thumbnail bucket</strong>.</p><p><strong>Step 3</strong>: Upload the video you need to convert into Input bucket.</p><p><strong>Step 4</strong>: From the services menu select Elastic Transcoder.</p><p><strong>Step 5</strong>: Click on <strong>Create New Pipeline</strong> button. You only need to do this one time.</p><p><strong>Step 6</strong>: Fill the form!</p><p><em>Pipeline name</em>: This must be unique to your account</p><p><em>Input Bucket</em>: Select the Input bucket you created before</p><p><em>IAM Role</em>: Select the Elastic_Transcoder_Default_Role. This is the default role AWS created for you while you created your account in AWS. If you prefer to use other IAM roles feel free to select them</p><p><strong><em>Configuration for Amazon S3 Bucket for Transcoded Files and Playlists</em></strong><em> — </em><strong><em>Section</em></strong></p><p><em>Bucket</em>: This is the Output bucket where the converted videos will be stored. Select your Output bucket.</p><p>Storage Class: Select the value “Standard” from the dropdown</p><p><strong><em>Configuration for Amazon S3 Bucket for Thumbnails — Section</em></strong></p><p><em>Bucket</em>: This is where the Thumbnail images generated by the Elastic Transcoder is stored. Select the Image thumbnail bucket you created earlier.</p><p><em>Storage Class</em>: Select the value “Standard” from the dropdown</p><p>In the <strong><em>Notifications section</em></strong>, I prefer to set everything to “No Notifications”</p><p><strong><em>Encryption — Section</em></strong></p><p><em>AWS KMS Key ARN</em>: Select the custom radio button. Doing this will create a new text box.</p><p><em>ARN Key</em>: Here you will have to enter your ARN Key. I will explain how to create your ARN key in the next section.</p><p><strong>Step 7</strong>: Click the “Create Pipeline” button. You will have wait until the new pipeline you created to change its status to Active.</p><p><strong>Step 8</strong>: Once The pipeline is active, click on the “<strong>Create New Job</strong>” button. To create a new job. For every video, you have to convert you will have to create a new job.</p><p><strong>Step 9</strong>: Fill the new form!</p><p><em>Pipeline</em>: Select your pipeline from the dropdown.</p><p><em>Output Key Prefix</em>: Here you will have to select the path where the output video should be saved in the Output bucket of your pipeline. AWS will automatically show you some suggestions as you type.</p><p><strong><em>Input Details</em></strong></p><p><em>Input Key: </em>Here select the video file you want to convert. AWS will automatically list all the contents of the Input bucket for you.</p><p><em>Decryption Parameters</em>: Select the None radio button</p><p><em>Available Settings</em>: Do not select any options here</p><p><strong><em>Output Details</em></strong></p><p>We will have to create multiple outputs based on the output requirements of our application. For our case, we will need 2M, 1.5M and 1M presets that are already there. So we will be creating 3 outputs using the “Add Another Output” option at the bottom of this section in AWS.</p><p><em>Preset</em>: From the dropdown select the preset that you need for first output select “System Preset: HLS 2M” for second output select “System Preset: HLS 1.5M” and for third output select “System Preset: 1M”.</p><p><em>Segment Duration</em>: This is the duration of each “.ts” segment file that will be created. I set this value to 10 meaning 10 seconds.</p><p><em>Output Key</em>: Enter name for the output file, this will be prefix added to each .ts file and the playlist the ts files are part of. Make sure this is unique for every output in this job.</p><p>Do not change any other values in this section</p><p><strong><em>Playlists</em></strong></p><p>In this section click on the “Add Playlist” button. The view will change to show some more contents now. Fill these contents as follows:</p><p><em>Master playlist Name</em>: The name of the playlist. Make this unique, trust me you will not regret this!</p><p><em>Playlist Format</em>: From the dropdown select the format “HLSv3”</p><p><em>Outputs in Master Playlist</em>: from the dropdown select an output you created before. After this click on the “+” button next to the dropdown, this will create a new dropdown with the same title, from this select the next output. Likewise, repeat the process to select all the 3 outputs we have created.</p><p><em>Content protection</em>: Select the HLS AES, then from the new dropdown pick “With Variant Playlists”. Make sure that the checkbox for “Autogenerate encryption key” is selected.</p><p><strong>Step 10</strong>: Last step click on the “Create New Job” button. Wait for some time for the job to complete. Once it is completed, got to the Output s3 bucket, and find the location where you have saved the converted video file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cyGZopIyZPzlsOuIUvQhQQ.gif" /></figure><p>From the multiple files that are here select the file with the name that you provided as the “<strong>Master Playlist Name</strong>”.playlist. Fetch the URL corresponding to this .playlist file. Make the necessary changes to convert this content to be distributed from CloudFront. That&#39;s it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kAAGFtON40jnkOyaOKSFg.png" /><figcaption>This is what AWS Elastic Transcoder does!</figcaption></figure><p>This time all the .ts files are secured, even if someone manages to download the .ts files, the files will not play! But…</p><h4>This is Not Enough…</h4><p>If any person who has the URL for the .playlist file can download the video from any video download manager 😅</p><p>Our solution for this problem is to use URL signing offered by CloudFront. Once you enable this the video you are streaming will be secured.</p><h3>About Me</h3><blockquote><strong><em>Check:</em></strong> <a href="https://about.me/chandrachudhk">https://about.me/chandrachudhk</a></blockquote><h4>Thank you for reading! Here’s a donut for you!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*_a1Lm-U7KsvmzPcm_H24kg.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a88411c8ef8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/streaming-videos-with-aws-elastic-transcoder-my-story-a88411c8ef8">Streaming Videos With AWS Elastic Transcoder My Story!</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS IoT and React Native, I love you, but you can do better.]]></title>
            <link>https://medium.com/f22labs/aws-iot-and-react-native-i-love-you-but-you-can-do-better-55799df7b4b6?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/55799df7b4b6</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[aws-iot]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[mqtt]]></category>
            <dc:creator><![CDATA[Chandrachudh K]]></dc:creator>
            <pubDate>Tue, 18 Sep 2018 13:16:48 GMT</pubDate>
            <atom:updated>2018-09-18T13:16:48.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUoyEaZgru5tk2Fibybkrw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/anapPhJFRhM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bence ▲ Boros</a> on <a href="https://unsplash.com/search/photos/iot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I recently started working with React Native and AWS IoT for a new project. Being a hardcore iOS developer, this change was a little hard to take on. Luckily I had a team of solid React Native developers to guide me.</p><p>My part of the project was not building the UI/UX or API integration, but baking real time communication using <a href="http://mqtt.org/"><strong>MQTT</strong></a>! for the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*iZro1zde22AxDI2qjWu47Q.gif" /></figure><p>The concept of <strong>MQTT</strong> may seem familiar to you if you’ve already worked with <a href="https://firebase.google.com/docs/"><strong>Firebase Cloud Messaging</strong></a><strong>.</strong></p><p>If not, no worries … this post isn’t going to help you much either … just kidding :)</p><h3>How MQTT Works? ⚙️</h3><blockquote><em>Publisher: </em>There are one or more publisher.</blockquote><blockquote><em>Subscriber: </em>There are one or more subscribers.</blockquote><p>A publisher can create and publish to multiple Channels (also called <em>Topics</em>).</p><p>A Subscriber can listen to multiple channels and fetch the real time published message. The message that is published is not stored anywhere unless you design your own MQTT broker.</p><p>Consider the MQTT broker as a box. Publisher pushes message into the box. Subscriber can connect to the box with the corresponding Channel name(Topic) and receive the message.</p><p>The most common convention to name a channel is using the pattern : “Topic/Subtopic”.</p><h3>GETTING STARTED ON AWS IoT 👍</h3><p><strong>Step 1</strong>: You need an AWS account.</p><p><strong>Step 2</strong>: Create a Cognito pool. This is for authentication purpose. If you don’t know how to create a Cognito pool check <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-identity-pool.html">here</a>.</p><p><strong>Step 3</strong>: When you are in your AWS home page search for “IoT Core” and visit the AWS IOT dashboard. If I were you I’d bookmark this page :)</p><p><strong>Step 4</strong>: To setup MQTT you will need the following :</p><blockquote>1.The AWS Cognito pool Id</blockquote><blockquote>2. A Policy</blockquote><blockquote>3. Your AWS IoT Specific IoT endpoint url.</blockquote><p>You already have a Cognito pool id from where you created the Cognito pool. If not create one. This one is Generic and can be used for all kinds of AWS Authentication (I believe … but hey, I’m no AWS wizard).</p><p>The detailed instructions for creating a policy can be found <a href="https://docs.aws.amazon.com/iot/latest/developerguide/create-iot-policy.html">here</a>. AWS IoT policies are JSON documents. They follow the same conventions as IAM policies. AWS IoT supports named policies so many identities can reference the same policy document. Named policies are versioned so they can be easily rolled back. To know more click check <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-policies.html">here</a>. After creating the policy, click on it, inside your policy’s overview tap on the “Edit policy document” button. and replace the JSON with:</p><pre>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: &quot;iot:Connect&quot;,<br>      &quot;Resource&quot;: &quot;*&quot;<br>    },<br>    {<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Action&quot;: [<br>        &quot;iot:Publish&quot;,<br>        &quot;iot:Subscribe&quot;,<br>        &quot;iot:Receive&quot;<br>      ],<br>      &quot;Resource&quot;: &quot;*&quot;<br>    }<br>  ]<br>}</pre><p>Find your custom endpoint in the <a href="https://console.aws.amazon.com/iot/home?region=us-east-1#/dashboard/help">AWS IoT console</a>. (From the dashboard, in the left navigation pane, choose <strong>Manage</strong>, and then choose <strong>Things</strong>. Select the box representing your button to show its details page. On the details page, in the left navigation pane, choose <strong>Interact</strong> and look for the <strong>HTTPS</strong> section, near the top.) Your endpoint will look something like the following:</p><pre>ABCDEFG1234567.iot.us-east-2.amazonaws.com</pre><p>where ABCDEFG1234567 is the subdomain and us-east-2 is the region.</p><h3>Now the setup part is over! Let the coding beginzzz ! 😅😎</h3><p>React Native has no native components available for our purpose through their regular packages. So I had to look for third party packages out there on the wild wild internet.</p><p>One such package that I came across was <a href="https://www.npmjs.com/package/react-native-mqtt">react-native-mqtt</a>. In this repo they recommend us to use <a href="https://github.com/eclipse/paho.mqtt.javascript">paho.mqtt.javascript</a> due to reasons that are not solved for a very long time! Nevertheless both packages where useless to me (as I am new to React Native and desperate to make MQTT work quickly), these packages didn’t run well with our AWS IoT usage.</p><p>Then came the good times when I found some packages which uses AWS. The packages I came across are:</p><ol><li><a href="https://github.com/jamesjara/react-native-aws-iot-device-shadows">react-native-aws-iot-device-shadows</a> a github repo by jamesjara.</li><li><a href="https://github.com/aws/aws-iot-device-sdk-js">aws-iot-device-sdk-js</a> by aws.</li><li><a href="https://github.com/kmamykin/aws-mqtt#aws-setup-and-security">aws-mqtt</a> another github repo by kmamykin.</li></ol><p>I also found some interesting reading <a href="https://github.com/aws/aws-iot-device-sdk-js/issues/86">here</a>.</p><p>I was testing all these packages on my iPhone 6+ … and all of them failed! But they did give me good knowledge of how AWS IoT and MQTT works.</p><h4>How did I do it then, you ask ? 😔</h4><p>I moved into native (iOS and Android) coding. Yes, I really did that, sorry React Native.</p><p>If you need to know where to look for native SDK’s visit this <a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html">page</a>.</p><p>AWS has given a nice sample code example <a href="https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift/">here</a> that works like a charm. We only have to make changes to their constants file about our 3 essential items I’ve mentioned above.</p><p>While starting the subscribe and publish for AWS IOT, the app needs to have a certificate. You can download the certificate from the AWS console. But in this app I prefer to create the certificate(only once) on run time and save it in the local memory to reuse it whenever needed.</p><h4>AWS IoT and iOS-Swift 🍎</h4><p>React Native supports only Objective C codes! But we are going to write the code in Swift. You will have to open the XCode project inside the iOS sub-folder in the React Native project’s workspace. Follow the following steps to implement the functionality.</p><p><strong>Step 1</strong>: Just as the good guys at AWS have in their sample app, initialize cocoapods and install the pod:</p><pre>pod ‘AWSIoT’, ‘~&gt;2.6.0&#39;</pre><p><strong>Step 2</strong>: Create a swift file to write the AWS IoT code. I called it <em>AWSMqtt.swift</em>. As soon as you create this file, XCode will ask you to create a bridge file. Create it, this is important. Your bridge file will of the name <em>&lt;Project name&gt;-Bridging-Header.h</em>. Add the following code to the bridge file.</p><pre>#import &lt;React/RCTBridgeModule.h&gt;</pre><pre>#import &lt;React/RCTEventEmitter.h&gt;</pre><pre>#import &quot;AWSCore.h&quot;</pre><pre>#import &quot;AWSIoT.h&quot;</pre><p><strong>Step 3</strong>: We will also have to create an Objective-C file to link the bridged native code to React Native’s Javascript. Name it the same as the swift file you created before, like: <em>AWSMqtt.m</em>.</p><p><strong>Step 4</strong>: Create AWSConstants.swift file to write the constants for the AWS IoT. Add the following values to it, remember to replace the necessary values of your own.</p><pre>let AWSRegion = AWSRegionType.&lt;your region&gt;//enum</pre><pre>let CognitoIdentityPoolId = &lt;Your Cognito pool id&gt;//String</pre><pre>let CertificateSigningRequestCommonName = &lt;name for the singing request&gt;//String</pre><pre>let CertificateSigningRequestCountryName = &lt;Country name&gt;//String, get it from locale</pre><pre>let CertificateSigningRequestOrganizationName = &lt;Organization’s name&gt;//String</pre><pre>let CertificateSigningRequestOrganizationalUnitName = &lt;Organization’s Unit name&gt;//String</pre><pre>let PolicyName = &lt;Your policy name&gt;//String. The name of the policy you already created for AWS IoT</pre><pre>// This is the endpoint in your AWS IoT console. eg: https://xxxxxxxxxx.iot.&lt;region&gt;.amazonaws.com</pre><pre>let IOT_ENDPOINT = &lt;The IoT endpoint url&gt;//String</pre><p><strong>Step 5</strong>: Take a look at the code <a href="https://gist.github.com/chandraf22/0f1723ca83edc13c06238a807931a224">here</a>. Add only the necessary code for the <em>AWSMqtt.swift</em>.</p><p><strong>Step 6</strong>: Now we need to make sure that the React Native knows what all methods are accessible. In-order to do that add the following code to the <em>AWSMQtt.m</em> file.</p><pre>#import &lt;React/RCTBridgeModule.h&gt;</pre><pre>#import &lt;React/RCTEventEmitter.h&gt;</pre><pre>@interface RCT_EXTERN_MODULE(AWSMqtt, RCTEventEmitter)</pre><pre>RCT_EXTERN_METHOD(setupAAWSMQTT)</pre><pre>RCT_EXTERN_METHOD(connectToAWSMQTT)</pre><pre>RCT_EXTERN_METHOD(publishToAWSMQTT:(NSString *)topic message:(NSString*)message)</pre><pre>RCT_EXTERN_METHOD(subscribeFromAwsMqtt:(NSString*)topic)</pre><pre>RCT_EXTERN_METHOD(unsubscribeTopic:(NSString*)topic)</pre><pre>RCT_EXTERN_METHOD(unsubscribeAllTopics)</pre><pre>@end</pre><p>The code above supports all the methods in AWSMqtt.swift file <a href="https://gist.github.com/chandraf22/0f1723ca83edc13c06238a807931a224">here</a>.</p><p><strong>Step 7</strong>: With step 6 you are all done with the iOS part. Now open your React Native project in your favourite text editor and open the JavaScript file you need to implement AWS IoT. Now add the following items to the React Native import.</p><ol><li>NativeModules</li><li>NativeEventEmitter</li><li>DeviceEventEmitter</li></ol><pre>import {NativeModules, NativeEventEmitter, DeviceEventEmitter} from &quot;react-native&quot;;</pre><p>Add the constants like:</p><pre>const { IoTModule } = NativeModules;//For android</pre><pre>const AWSMqttEvents = new NativeEventEmitter(NativeModules.AWSMqtt);//for ios</pre><p><strong>Step 8</strong>: To initialize AWS IoT for iOS devices,</p><pre>//Add necessary Listeners</pre><pre>AWSMqttEvents.addListener(</pre><pre>&quot;connectionStatus&quot;,</pre><pre>this.handleMqttStatusChange</pre><pre>);</pre><pre>AWSMqttEvents.addListener(&quot;message&quot;, this.handleMessage);</pre><pre>//Setup Mqtt</pre><pre>NativeModules.AWSMqtt.setupAAWSMQTT();//implemented in AWSMqtt.swift</pre><pre>setTimeout(() =&gt; {</pre><pre>//Establish Mqtt Connection</pre><pre>NativeModules.AWSMqtt.connectToAWSMQTT();//implemented in AWSMqtt.swift</pre><pre>}, 500);</pre><pre>//Handle changes for the MQTT Connection</pre><pre>handleMqttStatusChange(params) {</pre><pre>console.log(&quot;Connection Status&quot;, params);</pre><pre>}</pre><pre>//Process the MQTT datahere.</pre><pre>handleMessage(message) {</pre><pre>console.log(&quot;message: &quot;, message);<br>}</pre><p>This will setup and connect the AWS IoT. As you can see there is 500ms delay between calling setup and connect calls. This is because of the actual time delay experienced in setting up the AWS IoT. After connect wait for another second to make the subscribe and publish calls. Delays are only needed when you are executing all these code in one shot.</p><p><em>To Subscribe to a particular MQTT topic</em>:</p><pre>NativeModules.AWSMqtt.subscribeFromAwsMqtt(&lt;topic&gt;);</pre><p><em>To UnSubscribe from a MQTT topic</em>:</p><pre>NativeModules.AWSMqtt.unsubscribeTopic(&lt;topic&gt;);</pre><p><em>To UnSubscribe all MQTT topics</em>:</p><pre>NativeModules.AWSMqtt.unsubscribeAllTopics();</pre><p><em>To Publish to a MQTT topic</em>:</p><pre>NativeModules.AWSMqtt.publishToAWSMQTT(&lt;topic&gt;, &lt;message&gt;);</pre><p>We can now run the iOS app successfully!</p><h4>AWS IoT and Android-Java. 🤖</h4><p>I am an iOS Developer, so most of the code written for the Android part of AWS IoT, was by my friend <a href="http://twitter.com/SriHarish_60989">@SriHarish_60989</a>. Here is how it works:</p><p><strong>Step 1</strong>: Update the <em>MainApplication.java</em>’ s “<em>getpackages”</em> function by adding</p><pre>new MainReactPackage(),</pre><pre>new AwsIoTPackage(),</pre><p><strong>Step 2</strong>: We have to create the package “<em>AwsIoTPackage</em>”. Create <em>AwsIotPackage.java</em> like we have done <a href="https://gist.github.com/chandraf22/340f243206153c318a3da493914b95be">here</a>. Add this file in the same folder as the MainApplication.java.</p><p><strong>Step 3</strong>: Create a new java file on the same folder. We called it <em>AwsIoTModule.java</em>. Refer the code <a href="https://gist.github.com/chandraf22/70bd747b8f08f32698e457365f4f3866">here</a> to create your own module and make the necessary changes for the constants that you need to add.</p><p><strong>Step 4</strong>: With the above 3 steps and codes you can implement the Java code. Now open the React Native project and write necessary code from <strong>Step 7</strong> of iOS AWS IoT. The DeviceEventEmitter is the component needed for Android. Also don’t forget to add the constant:</p><pre>const { IoTModule } = NativeModules;//For android</pre><p><strong>Step 5</strong>: To initialize AWS IoT in Android devices:</p><pre>//Add necessary Listeners</pre><pre>DeviceEventEmitter.addListener(&quot;Status&quot;, this.handleMqttStatusChange);</pre><pre>DeviceEventEmitter.addListener(&quot;subscribe&quot;, this.handleDriverData);</pre><pre>//Setup Mqtt</pre><pre>setTimeout(() =&gt; {</pre><pre>console.log(&quot;Initialise Aws Mqtt&quot;);</pre><pre>IoTModule.initializeAWSMqtt();</pre><pre>}, 1500);</pre><pre>//Establish Mqtt Connection</pre><pre>setTimeout(() =&gt; {</pre><pre>IoTModule.connectAWSMqtt();</pre><pre>}, 3000);</pre><p>The delays are necessary due to the initialisation process, only needed when you are executing all these code in one shot.</p><p>To Subscribe to a particular MQTT topic/channel:</p><pre>IoTModule.subscribe(&lt;topic&gt;);</pre><p>To UnSubscribe a MQTT topic/channel:</p><pre>IoTModule.unsubscribe(&lt;topic&gt;);</pre><p>To UnSubscribe all the MQTT channels/topics:</p><pre>IoTModule.unsubscribeAll();</pre><p><em>To Publish to a MQTT topic</em>:</p><pre>IoTModule.publish(&lt;topic&gt;, &lt;message&gt;);</pre><p>That’s it for the Android part.</p><h3>How to test the code? 😈</h3><p>Open AWS IoT Console, take a look at the panel on the left side of the page. The last option is <em>Test</em>. Open it. The page itself is self explanatory. You can subscribe and publish from the same page.</p><h3>Stuff that I would love to have: ❤️</h3><ol><li>An nice React Native package to do this, instead of writing the code for both iOS and Android separately. The package should have a sample project and step by step details on how to implement it.</li></ol><h3>Why write this article? 🤔</h3><p>I was new to React Native and started working on this topic without any knowledge. While working on this topic I always wanted get a article like this to help me around, but there were none.</p><h3>Some interesting reads, links and references: 🧐</h3><ol><li><a href="https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices">https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices</a></li><li><a href="http://www.steves-internet-guide.com/understanding-mqtt-topics/">http://www.steves-internet-guide.com/understanding-mqtt-topics/</a></li><li><a href="https://www.youtube.com/watch?v=jZL4uohxuPc&amp;feature=youtu.be">https://www.youtube.com/watch?v=jZL4uohxuPc&amp;feature=youtu.be</a></li><li><a href="https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/">https://diyprojects.io/8-online-mqtt-brokers-iot-connected-objects-cloud/</a></li><li><a href="https://docs.aws.amazon.com/iot/latest/developerguide/configure-iot.html">https://docs.aws.amazon.com/iot/latest/developerguide/configure-iot.html</a></li><li><a href="https://docs.aws.amazon.com/iot/latest/developerguide/iot-gs.html">https://docs.aws.amazon.com/iot/latest/developerguide/iot-gs.html</a></li><li><a href="https://github.com/jamesjara/react-native-aws-iot-device-shadows">https://github.com/jamesjara/react-native-aws-iot-device-shadows</a></li><li><a href="https://docs.aws.amazon.com/iot/latest/developerguide/view-mqtt-messages.html">https://docs.aws.amazon.com/iot/latest/developerguide/view-mqtt-messages.html</a></li><li><a href="https://github.com/aws/aws-iot-device-sdk-js/issues/86">https://github.com/aws/aws-iot-device-sdk-js/issues/86</a></li><li><a href="https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift/">https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoT-Sample/Swift/</a></li><li><a href="https://github.com/awslabs/aws-sdk-android-samples">https://github.com/awslabs/aws-sdk-android-samples</a></li><li><a href="https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03">https://teabreak.e-spres-oh.com/swift-in-react-native-the-ultimate-guide-part-1-modules-9bb8d054db03</a></li></ol><p>Thanks to <a href="https://medium.com/@murtazz?source=post_page">Murtuza Kutub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55799df7b4b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/aws-iot-and-react-native-i-love-you-but-you-can-do-better-55799df7b4b6">AWS IoT and React Native, I love you, but you can do better.</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A prospect almost hired us… but then ditched us for another company… here’s what we did next to win…]]></title>
            <link>https://medium.com/f22labs/a-prospect-almost-hired-us-but-then-ditched-us-for-another-company-heres-what-we-did-next-to-dac7fd187f0b?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/dac7fd187f0b</guid>
            <category><![CDATA[sales-development]]></category>
            <category><![CDATA[content-marketing]]></category>
            <category><![CDATA[marketing-automation]]></category>
            <category><![CDATA[sales]]></category>
            <dc:creator><![CDATA[Murtuza Kutub]]></dc:creator>
            <pubDate>Sat, 10 Feb 2018 03:43:55 GMT</pubDate>
            <atom:updated>2018-02-10T07:30:40.180Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>A prospect almost hired us… but then ditched us for another company… here’s what we did next to win them over !</strong></h3><p>Last year one of our prospects suddenly gave away a big mobile app development project to another company. This happened after multiple rounds of detailed and almost final leg discussions with us.</p><p>The reason?</p><p>The other company was willing to develop the mobile app at a far lesser cost and in a much smaller timeframe, while our prices were way higher, almost the cost of the prospect’s firstborn :P</p><p>So … we parted ways, but on a positive note.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/0*jioXI5jAF7D8b8IR." /></figure><p>Well, not exactly this way…but you get the drift right?</p><p>Now, I am a firm believer in forging strong relationships. So, I did not forget the prospect.</p><p>I kept my communication channels open with them. From sharing interesting industry updates to following up with them about the progress of the app, I tried to be more of a friend than a consultant. I had thus entered the friendzone.</p><p>We regularly discussed the status and progress of the project. The client also shared the occasional hiccups they faced initially with me, and as a friend, I also started giving them advice on how to overcome them.</p><p>Our friendzone period continued for a while, when one day the prospect finally popped a question to me — Can your team rescue us from this hell ? Can we try your team out with a paid trial ?</p><p>I was of course delighted — almost did a little jig in the conference room. I agreed to do the paid trial for a few weeks. The prospect loved the work our team did. They were convinced that we could develop a MUCH better app than the other company, which is why, one day, they suddenly emailed me to inform about their decision to give us the entire project.</p><p>We were ecstatic. We had to literally pinch ourselves hard to believe that the same prospect who ditched us for another company, was our client now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*tt1qQvP5YvwdnX8c." /><figcaption><strong>That was my reaction when I read the email</strong></figcaption></figure><p><strong>What changed ?</strong></p><p>By now, I am sure you may have several questions in your mind.</p><p>Like, did I force them to give us the project?</p><p><em>Not at all.</em></p><p>Did I spread malicious information about the other company?</p><p><em>I would never ever do that.</em></p><p>Did I influence them?</p><p><em>Yes, but in a fair and ethical manner!</em></p><p>I did not do any nasties to take away the project from my competitor. I cared for the client’s project and genuinely tried to help them even when we were not a part of it and that’s what worked in our favour.</p><p>I know it’s going to sound cliche, but winning a client requires as much efforts as proposing your partner.</p><p>You can’t force, or stalk them to seal the deal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/0*WcnCmL4CBCgHWT1r." /><figcaption>That’s not how you do Rose</figcaption></figure><p>You have to patiently build a relationship of trust with the customer.</p><p>Yes, I know everybody shares this generic ‘gyaan’ on building trust, but I am going to move a step ahead and tell you exactly my 2-step process for getting results like the one mentioned above. So read ahead to know the secret.</p><p><strong>Step 1 — Become their friend</strong></p><p>Duh ?! Every relationship begins with friendship. Business works on the same premise.</p><p>You have to warm up to the client before giving a sales pitch (you don’t want to look like that friend who turns up only when they need money, do you?). They have to trust you enough to give you the project.</p><p>There are several ways to do it — and no it does not include sending bouquets to the client, his wife, or his pet.</p><p>That is creepy.</p><p>You CANNOT be a narcissist either. So, if you plan to inundate your client with emails about your greatness, then let me break your heart — THEY DON’T CARE ABOUT YOU!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/244/0*N15qe-4Efh-CVGxF." /><figcaption>How you think they see your email</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*m9dTsKGIkm_gSD4c." /><figcaption>How they see it</figcaption></figure><p>They care for their business and are interested in knowing how you will help them achieve it. That’s exactly what your communication should revolve around — about THEM, NOT YOU!</p><p><strong>You just have to give them what they want </strong>— <strong>Useful content !</strong></p><p>People love it when you give them solutions to a problem or an impending challenge for free. Educational content serves that purpose. Pick up a topic that has been troubling your client or his industry or a buzzword that has caught everyone’s attention and revolve your content around it.</p><p>Your content could be in any form — blogs, videos (everybody loves videos), white paper, e-books, and podcasts.</p><p>The key is — it should serve the following purpose:</p><ol><li>Educate your clients</li><li>Engage them in a conversation</li><li>Embrace you as a trusted voice by subscribing to your content</li></ol><p><strong>The secret sauce to creating awesome content</strong></p><p>Let’s assume you are a company that helps businesses in digital transformation and your target companies are the brick and mortar shops.</p><p>Now, how will you convince them to take their business online?</p><p>One method is to send them cold emails. It might succeed in getting few clients who were already thinking about taking their business online.</p><p>But what about those who are not even remotely interested in going online but have a huge potential to succeed if they do?</p><p>Will you ignore them? That could be a grave mistake especially if they are a potential golden goose of your business.</p><p>So what’s the solution?</p><p>Easy. Just pursue them and show them the beautiful world of doing business online.</p><p>The best way to do this is by creating useful and awesome content that talks about the business.</p><p><strong>Bonus points if it includes a cute cat’s GIF that flows with your content.</strong></p><p>It could be on anything — advantage of changing the business model, pressing on the pain points of the current business model that becomes easier with the digital transformation, trends in the industry, and so on.</p><p>You just have to find the right topic.</p><p><strong>And the best way to find that topic is ….. Drumrolls … by using Google Alerts! …</strong></p><p><strong>Dun Dun Dun !</strong></p><p>Let’s face it; you cannot keep a tab on everything that’s happening in your client’s industry.</p><p>You may not even have the time to read more than two newsletters out of the ten you subscribed to. It is here that Google Alerts comes to your rescue.</p><p>It gives you all the information that you need without you having to break a sweat.</p><p>It’s pretty simple to use. Just enter the keywords, that is the topic on which you need information, click on the ‘Create Alert’ button, and relax!</p><p>You will receive all the updates related to the topic in your mailbox as per the options you have selected.</p><p>See an example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8esibOZ__TNx1whQ." /></figure><p>Once you create an alert, you will receive useful articles across the web. All you need to do is — read the article, do some groundwork by studying more about it, and create an original piece of content peppered with real life examples and stats (yes, people love reading stats and real success stories).</p><p>For example, in this case, the article on why retailers should turn to technology in 2018 could be a useful article for you and your client. It talks about why technology is important for retail industry.</p><p>You can do a different type of content keeping the theme of the article as the base.</p><p>You can write a blog with facts and figures, you may create a listicle on 5 reasons why technology is important in retail, you can even create a video on it. You get the drift.</p><p>The idea is … your client should relate to your content.</p><p>You can even create multiple alerts for a different related keywords to get a complete overview.</p><p>For example, besides creating an alert on digital transformation in retail, I have also created an alert on technology in retail to get more information on the topic.</p><p>This will help me improve the quality of my content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aCImbuc6rl1ZeXhc." /></figure><p>Tadaaa … your content is ready!</p><p>You have won the first leg of the game! Now let’s look at the second part of it.</p><p><strong>Step 2 — Follow-up, follow-up, follow-up your boat, gently down the stream …</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*WZZPY6hJ2VLr4iUp." /><figcaption>Follow up to follow your dreams</figcaption></figure><p>Imagine this, you go out on a date with someone. It goes well and you would like to spend more time with them. Obviously you will text or call him/her to subtly check if he/she is as interested in you, as you are in him/her, so you can make the next move.</p><p>Business works the same way.</p><p>Remember how I kept communicating with the client even when I was not a part of the project?</p><p>It helped me build a healthy relationship with the client. Follow-up is very important to get a new client. You cannot send one email on how technology helps the retail industry and forget about it. You have to create follow-up content on how they can transform their business model to reinforce the idea.</p><p>Remember, the more you discuss about the topic, the stronger are your chances of winning the deal.</p><p>And you don’t have to worry about dearth of relevant topics when there is Google Alerts available at your disposal. Create alerts on the topics you need to be informed on, get high quality content delivered to you, curate it for your prospects and create follow-up content, link it to your previous content on the same article to form a flow, and watch out for your client’s reaction!</p><p>They will soon start looking forward to your content.</p><p><strong>But …. You got to be patient, son !</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*zwAx7iAOLNQ2_DeZ." /><figcaption>It takes time to catch the right client</figcaption></figure><p>Your date isn’t going to become your life partner immediately. You have to pursue them consistently and patiently till they trust you enough to walk down the aisle.</p><p>I hear you … Sending informational / educational content regularly and following up is hard if you do it manually for each of your prospects …</p><p>Imagine you have a list of 100 prospects you want to do business with. I know you are not going to be able to keep a tab on whom you sent which email and what their action was.</p><p>Who opened the email … Who clicked on your blog link in the email … Who replied back … Who wants to get on a phone call with you ….</p><p><strong>Enter … drumrolls … Automation tools like … more drumrolls … like Mixmax, Drip and Autopilot, Mailshake and many others.</strong></p><p>You spend a little initial energy setting them up once and the tool keeps engaging with your prospects on your behalf (the way you setup the automation) without you having to lift a finger.</p><p>Pursuing prospects successfully requires lot of commitment, skill and perseverance.</p><p>But if done right, you can be assured of a long-term engagement with your client.</p><p>Even if it means waiting for a year to hear back from them !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/0*nLJx_SHN8fZ91P9c." /><figcaption>Are you ready for IT?</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dac7fd187f0b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/a-prospect-almost-hired-us-but-then-ditched-us-for-another-company-heres-what-we-did-next-to-dac7fd187f0b">A prospect almost hired us… but then ditched us for another company… here’s what we did next to win…</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create, export and import components in React Native (vs JAVA)]]></title>
            <link>https://medium.com/f22labs/creating-and-importing-components-in-react-native-vs-java-78fe328b3e98?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/78fe328b3e98</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[mobile-apps]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Chandrasekar Kuppusamy]]></dc:creator>
            <pubDate>Fri, 22 Dec 2017 13:46:31 GMT</pubDate>
            <atom:updated>2017-11-04T16:01:47.066Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is a Component?</strong></p><p>The Components are the building blocks in React Native which is similar to the container where all UI elements do accumulate and help to render details in the foreground as a native UI on either Android or iOS devices.</p><h3><strong>How to create a Component?</strong></h3><p>I assume that React Native installed on your machine, If not no worries, Please refer my previous blog post on <a href="https://takeoffandroid.com/react-native-setup-in-mac-for-a-progressive-application-development-e9fb001c62c3">Environment setup</a>.</p><p><strong>Code Implementation:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c8fb26323b494defa886d5e69799e6a/href">https://medium.com/media/8c8fb26323b494defa886d5e69799e6a/href</a></iframe><p>Copy-paste the above code snippets into index.js. You’re right to go. Yet confused? Chill! Let’s break the code into pieces in a better way.</p><pre>       <strong>React Native                           JAVA</strong></pre><pre><br><strong>import</strong> React from &#39;react&#39;;             <strong>import</strong> java.util.*;</pre><pre><strong>import</strong> { Text, AppRegistry } <br>    from &#39;react-native&#39;;               <strong>import</strong> java.text.*;</pre><pre><strong>const</strong> App = () =&gt; (                    public <strong>class</strong> App {</pre><pre>);                                     }</pre><pre><strong>AppRegistry</strong>.registerComponent          <strong>package</strong> com.componentdemo<br>(&#39;ComponentDemo&#39;, () =&gt; App);</pre><p><strong>const</strong> — This is similar to a class in JAVA, which lets you declare a component block in React Native.<br><strong>AppRegistry</strong> — is the kick starter helps to build React Native apps where all parent or root component should be registered using ‘registerComponent’ function.<br><strong>&lt;Text&gt;</strong> — This is similar to <strong>&lt;TextView&gt;</strong> in Android and <strong>&lt;Label&gt;</strong> in iOS.</p><h3>How to export a Component ?</h3><p>It’s simple. Create <strong>‘src/components/YOUR_FILE_NAME.js’ </strong>inside your project <strong>root </strong>folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*u1M9zNOzHkWx4V1OxV6uBg.png" /></figure><p>Create a component ‘<strong>Title’ </strong>and export it as a reusable component.</p><p><strong>For Example:</strong></p><pre>export default Title; //Provides export access for the component</pre><p><strong>Code Implementation:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a435dc30a245a52cdebb8943bdd2fb7d/href">https://medium.com/media/a435dc30a245a52cdebb8943bdd2fb7d/href</a></iframe><h3>How to import a Component from different .js file ?</h3><p>Add the following import statement in the destination Component <strong>.js </strong>file.</p><pre>import Title from &#39;./src/<strong>components</strong>/importcomponentdemo&#39;;</pre><p><strong>Complete code:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/674fcf595ab02822c7ee15f12db9c247/href">https://medium.com/media/674fcf595ab02822c7ee15f12db9c247/href</a></iframe><p><strong>Output:</strong></p><blockquote>“<em>Hello Title</em>”</blockquote><p>Yes! You’re done. Now it’s possible to access &lt;<strong>Title</strong>&gt; property from the base file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78fe328b3e98" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/creating-and-importing-components-in-react-native-vs-java-78fe328b3e98">Create, export and import components in React Native (vs JAVA)</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with React Native for Mac]]></title>
            <link>https://medium.com/f22labs/react-native-setup-in-mac-for-a-progressive-application-development-e9fb001c62c3?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/e9fb001c62c3</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[hybrid-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Chandrasekar Kuppusamy]]></dc:creator>
            <pubDate>Fri, 22 Dec 2017 13:46:12 GMT</pubDate>
            <atom:updated>2017-11-08T05:41:48.006Z</atom:updated>
            <content:encoded><![CDATA[<p>As we all know that Facebook is the creator of react native, which lets you build apps using Javascript for both iOS and Android.</p><p><strong>Tools and development environment?</strong></p><p>Similar to other framework and programming languages, the React Native expects the following things that has to be setup as a beginner.</p><h4>1. Xcode</h4><p>Do you wanna build apps for iOS as well? Then please go ahead with the Xcode installation from the app store. Hey! Again I support only for Mac. Sadly no support for Windows, Linux and other platforms.</p><p><strong>2.Brew</strong></p><p>Brewing coffee even takes some time but installing or updating apps are easy with <strong>Brew</strong>. Yeah! It provides an easy option to install softwares, packages, SDK’s and libraries using simple commands on iTerm.</p><p>For example:</p><p><strong>brew install mysql </strong>— Installs mysql into your mac.</p><p><strong>brew update mysql </strong>— Updates mysql to latest version.</p><p><strong>brew cask install google-chrome</strong> — Installs Google chrome.</p><p><strong>3. Node/NPM</strong></p><p>Oooh! Here comes the main warrior who actually helps to make Javascript work outside the browser environment and NPM manages the dependencies.</p><p>Let’s take this ahead and see further to install Node on your machine.</p><p><strong>brew install node</strong> — This installs node and other related packages to your Mac. (Really Brew made it simple!).</p><p>It’s time to verify your installation of the node using <strong>node -v </strong>command from a terminal. It should say <strong>v8.8.1</strong> or any versions which is installed.</p><p><strong>4. Watchman</strong></p><p>Watchman is a tool by Facebook for watching changes in the filesystem. It keeps an eye on the modified changes or updates that are made to particular files.</p><p><strong>brew install watchman</strong> — This installs watchman to your mac.</p><p><strong>5. Editors (Sublime or Atom or Vscode)</strong></p><p>Though there are few IDE exists like <a href="https://www.decoide.org/">Deco</a>, the editors like Sublime or Atom provides ample amount of customisation when it comes to Auto suggestion, lint, error correction, etc. I prefer Atom for React Native development. (Not really biased ;-))</p><p><strong>6. The React Native CLI</strong></p><p>Node comes with npm, which lets you install the React Native command line interface.</p><p>Run the following command in a Terminal:</p><p><strong>npm install -g react-native-cli</strong></p><p><strong>7. Lint/ESLint</strong></p><p>This is one of the cool feature with Atom, which lets you know when you’re helpless or stuck while coding by pointing your syntax errors.</p><p><strong>Setup:</strong></p><ol><li>Navigate to root project and enter <strong>npm install — save-dev eslint-config-standard</strong></li></ol><p>2. Create <strong>.eslintrc</strong> in the project root folder and paste the following snippet</p><pre>{<br>  &quot;extends&quot;: &quot;standard&quot;<br>}</pre><p><strong>For example:</strong></p><p>I have a habit of missing or closing brackets ‘()’</p><p>Failed to add semicolons ‘;’</p><blockquote><strong>Installation</strong>: Navigate to <strong>Atom — Preferences — Install — Search for eslint and Install </strong>in your Atom</blockquote><p><strong>Some common React Native Terminal Commands?</strong></p><ol><li><strong>react-native init</strong> <strong>HelloWorld</strong> — Creates new React Native project</li><li><strong>react-native run</strong>-<strong>ios</strong><em> —</em>Build and run the React Native project in your iOS simulator or device (Fingers crossed if XCode is not installed or updated properly)</li><li><strong>react-native run</strong>-<strong>android</strong> — Build and run the React Native project in your Android emulator or device (Make sure your Android Sdk and Gradle are installed)</li><li><strong>npm install — — save-dev eslint-config-standard — </strong>Used to configure elslint in atom</li><li><strong>npm start — — reset-cache </strong>— Reset Cache</li><li><strong>npm install — — save redux react-redux — </strong>Enables redux support</li><li><strong>npm install native-base — save</strong>- Initialise Native Base libray</li></ol><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9fb001c62c3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/react-native-setup-in-mac-for-a-progressive-application-development-e9fb001c62c3">Getting started with React Native for Mac</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Super easy mobile deep links with Branch.io]]></title>
            <link>https://medium.com/f22labs/super-easy-mobile-deep-links-with-branch-io-edb1adf05689?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/edb1adf05689</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[deep-linking]]></category>
            <category><![CDATA[app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Kishore Babu]]></dc:creator>
            <pubDate>Fri, 07 Jul 2017 06:51:51 GMT</pubDate>
            <atom:updated>2017-07-07T06:51:51.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0LKwl48NnsmfSR-U0KNOw.jpeg" /><figcaption>Photo by <a href="http://unsplash.com/photos/BaMHwcH2RUk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Josh Felise</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>So, here’s the scenario: Your shiny new app needs to have deep links to guide a user to the exact content, when shared through your messaging app of choice (e.g. Slack, WhatsApp, iMessage, etc.)</p><h3>In comes Deep Link.</h3><p>Let’s say I’m discussing this very post with a friend. How would I direct this person to the correct blog post? One way is for them to user their search engine of choice (*cough* Google *cough*) and lookup <a href="https://www.google.co.in/search?q=Medium.com+%2B+Kishore+Babu+%2B+deep+links+Branch.io&amp;oq=Medium.com+%2B+Kishore+Babu+%2B+deep+links+Branch.io&amp;aqs=chrome..69i57.2854j0j7&amp;sourceid=chrome&amp;ie=UTF-8">“Medium.com + Kishore Babu + deep links Branch.io”</a>. Now that <strong>may</strong> work (It hasn’t yet — I continue to pray to the SEO gods). Another way, is for me to simply share the URL for this post with them.</p><p>How would that work on a smartphone though? Since it’s a web URL (https://…) I would expect Chrome on Android, or Safari on iOS to open the web version of this post.</p><p>But if the Medium app on Android or iOS is setup well, it would pickup this URL and show this exact blog post on the app by picking up the deep link.</p><p>This is similar to how I can open a product on the Amazon app when clicking on a shared product URL. Kinda cool, right ?</p><p>What if the app is not installed, and I do not wish to show a web page corresponding to the URL? I expect the user to be redirected to the Google Play Store on Android, or the App Store on iOS. To implement this, there’s a non-trivial amount of work involved in the website part of your product.</p><h3>I don’t have a website — or I don’t want to spend effort on the website for this</h3><p>I hear ya. Nor do I. Allow me to introduce<a href="https://branch.io/"> Branch.io</a>.</p><p>With Branch.io, We can implement mobile deep links without too much involvement from the web team.</p><p>Let’s build a <a href="https://github.com/barykaed/SampleBranch">sample app</a> to demonstrate. (The sample app is made in Kotlin)</p><p><a href="https://github.com/barykaed/SampleBranch">barykaed/SampleBranch</a></p><p>Sign up for a new account at <a href="https://branch.io/">Branch.io</a>. Once you’re through, the next screen you’ll see will be the following (Fig 1.):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puvcGRTCAO-uvMDfWywXhQ.jpeg" /><figcaption>Fig 1. Click “Finish Later”. This isn’t immediately relevant to us at this stage.</figcaption></figure><p>These steps aren’t important right now if you’re creating a simple app, Let’s skip ahead to the dashboard by clicking on “Finish Later”.</p><p>Next we see the dashboard for Branch.io. (Fig 2.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AaiPy6C53PyYCY5cV5KyyQ.jpeg" /><figcaption>Fig 2. This will be your dashboard for Branch.io</figcaption></figure><p>Let’s go ahead and give our app a name. Go to the <a href="https://dashboard.branch.io/account-settings/app">account settings page</a>, (Fig 3.) and enter an App Name. You’ll also see the <em>Branch Key and Branch Secret</em>. You’ll need the <em>Branch Key</em><strong><em> </em></strong>in the <a href="https://github.com/barykaed/SampleBranch/blob/master/app/src/main/AndroidManifest.xml">Android App Manifest.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HaO68J-DVsyLdBKu8KuXBg.png" /><figcaption>Fig 3. Rename your app <a href="https://dashboard.branch.io/account-settings/app">here.</a></figcaption></figure><p>Go to the <a href="https://dashboard.branch.io/link-settings">link settings</a> page on the dashboard (Fig 4.). Make sure the “Always try to open app” checkbox is checked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hO03gfFqJ-QxsBWYU_K08Q.png" /><figcaption>Fig 4. Check the “Always try to open app” box.</figcaption></figure><p>Below, in the Android section, fill the desired Android URI scheme. This needs to be unique — so that the OS can inform your app of the intent. If this is not unique across app, you’ll see an app chooser pop up when these intents are fired by Branch.io.</p><p>I don’t intend to publish this sample app to the Google Play Store, so I’ll fill in a custom url instead. This would likely be the web homepage for your app.</p><p>Starting from API 23 (Marshmallow), Android has app links. These skip the browser for handoff to the app, and try to launch the app directly. So let’s go ahead and try that.</p><p>We’ll also need the SHA256 of our signing keystore — whether debug or release.</p><p>Go ahead and locate your keystore path and execute the following command from the terminal.</p><blockquote>keytool -list -v -keystore absolute/path/to/debug.keystore</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*60Nh76czPJg-uKG-Bs6Btw.png" /></figure><p>Copy the SHA256 from the output, and paste it in the SHA256 Cert Fingerprints section (Fig 5.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2-Msr_l5DXAdwSnXxewYEQ.png" /><figcaption>Fig 5. Android App settings for Branch.io</figcaption></figure><p>Finally, add a default URL (Fig 6.), and choose a Link Domain (Fig 7.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7R-aPgbXY6D9EDnbyqxA0A.png" /><figcaption>Fig 6. Default URL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CKetp-jABRZKIwNwnZDayQ.png" /><figcaption>Fig 7. Link Domain — We use the samplebranch.app.link scheme to generate our deep links.</figcaption></figure><h3>That’s a lot of setup — When do I write some sweeeeet sweeeeet code?</h3><p>Clone the <a href="https://github.com/barykaed/SampleBranch">sample repo</a>. Let me walk you through the various parts.</p><p>The <a href="https://github.com/barykaed/SampleBranch/blob/master/app/src/main/AndroidManifest.xml">AndroidManifest.xml</a> is the most interesting part here.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd09274a270be50601db1a629a8613d7/href">https://medium.com/media/dd09274a270be50601db1a629a8613d7/href</a></iframe><p>It has the Branch Key we saw earlier added as meta-data. The MainActivity.kt has intent filters for our URI scheme of “samplebranch://” and the link domains of “samplebranch.app.link”, etc. Also included is a broadcast receiver for Install Listener from the Google Play Store. This serves a pretty neat purpose — your deep links will work across app download and install from the Google Play Store. Pretty neat right?!</p><p>Next, we initialise the Branch instance in SampleBranchApplication.kt — which is our custom Application class.</p><p>Moving on to the MainActivity.kt, we add listeners on OnStart and OnNewIntent to pick up the data from Branch once we receive the deeplink intent.</p><p>Our custom parameters, “content_id” which we added while creating the deeplink, shows up as part of a JSONObject metadata of BranchUniversalObject. That’s how one would read custom parameters off of BranchUniversalObject.</p><p>Reading aside, Let’s see how to create a deep link.</p><p>We would build an instance of BranchUniversalObject by adding our custom parameters as ContentMetaData, and provide other fields as ContentImageUrl, ContentTitle, ContentDescription. These fields are shown when the deep link is shared, and a preview is shown for the link (Fig 8.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJ_e6qUAQm455DqiPo7QOw.png" /><figcaption>Fig 8. Deep link shared in Slack shows a preview.</figcaption></figure><p>Once we click on this deep link, we see an app chooser menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*7UJtZ9zVA70eCNsoovoyuQ.png" /><figcaption>Fig 9. Pick an app to open link. This is on API 23.</figcaption></figure><p>Pick the SampleBranch app, Once we open it…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*ksYt84gZa6XuswZ7h6XSnA.png" /><figcaption>Fig 10. Our Deep Link works!!</figcaption></figure><p>… and Voila! Our deep link works.</p><p>Phew! There’s no reason to avoid having deep links in your apps now!</p><p>Go ahead and give Branch.io a try today.</p><p>If you found this helpful, please hit the “Like” button, and share far and wide for more people to find.</p><p>I look forward to reading your feedback in the comments, and on Twitter (find me <a href="https://twitter.com/kishorebabuin">@KishoreBabuIN</a>). Cheers!</p><p>That was a long read. You deserve a happy potato :)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FU1rlk8zdcAwbm%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FU1rlk8zdcAwbm%2Fgiphy.gif&amp;image=http%3A%2F%2Fmedia0.giphy.com%2Fmedia%2FU1rlk8zdcAwbm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/36f872af57419054f0160726e679dde7/href">https://medium.com/media/36f872af57419054f0160726e679dde7/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edb1adf05689" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/super-easy-mobile-deep-links-with-branch-io-edb1adf05689">Super easy mobile deep links with Branch.io</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Instagram like Bottom tab Fragment Transaction Android]]></title>
            <link>https://medium.com/f22labs/instagram-like-bottom-tab-fragment-transaction-android-389976fb8759?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/389976fb8759</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[tablayout]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[bottomnavigationview]]></category>
            <category><![CDATA[fragments]]></category>
            <dc:creator><![CDATA[Chandrasekar Kuppusamy]]></dc:creator>
            <pubDate>Fri, 12 May 2017 06:16:33 GMT</pubDate>
            <atom:updated>2017-10-27T11:26:20.746Z</atom:updated>
            <content:encoded><![CDATA[<h4>Have you ever faced issues with fragment ?</h4><p>The Answer from all the techies would be “Yes”, because dealing with Fragments are not direct, simple and easy to implement. I know handling backstacks with add and replace are like “The Ghost and the darkness”.</p><h4>What inspired me to write this post ?</h4><p>The reason is “Instagram”. I love to play with Insta app since it is easy, robust and less screen navigation, which in turn collectively bottom tab navigation took the peek place in the Android community.</p><h4>Is that hard to implement sticky Bottom tabs with Fragments transactions in all the screens?</h4><p>Yes before this post peeped in :)</p><p>Ok! lets do some technical stuff. In this article, we’re gonna implement Bottom tabs with Fragments and nested Fragment transactions. Confused! Following Gif explains in a better way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*iVX-qML8jcpewrnvnfHS8A.gif" /></figure><p>Yeah! Here if you see the above Gif, there are five tabs like <strong>Home, Search, Share, News and Profile. </strong>Selecting each tab options, respective Fragments are pushed. That’s obvious isn’t?. Cool! If you notice keenly, I have assigned “<strong>CLICK ME</strong>” button for <strong>Home</strong> and <strong>News Fragments </strong>to showcase the behaviour of Nested Fragments Transactions inside same Fragments without losing its state. Let’s do it in a linear way.</p><ol><li>Tap on<strong> “CLICK ME” </strong>button.</li></ol><p>2. Can you see that Toolbar text has changed from “<strong>Home</strong>” to “Sub Home 1” and so on till “Sub Home 4” by clicking it four times? Yes! It does!, all these <strong>Sub Home 1</strong> ….. <strong>Sub Home 4</strong> are nested fragments inside <strong>Home</strong> (Main Fragment) . Ideally, new fragments are pushed and replaced with one after the other with successive clicks. Yup! Bottom bars are always fixed too.</p><p>3. Now navigate to another tab, come back again and check the behaviour in “<strong>Home</strong>” tab. The state is maintained with the same screen where you left (<strong>Sub Home 4, 4th fragment</strong>) :)</p><p>4. Finally, click back button and experience the behaviour that previous fragments are popped in automatically without losing the previous states. Yeah! This works even with back soft key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*cS7QWVBCuzSMC7DW-VdtwQ.gif" /></figure><h4>Why <strong>TabLayout instead of </strong>Design support BottomNavigationView?</h4><p>I have plenty of reasons for the same as below:</p><ol><li>It’s not flexible.</li><li>Random behaviour if there are less tab items.</li><li>Customising text sizes and icon sizes are like a nightmare (Just try adding small sized icon for one tab and big sized icon for the other ;-) ).</li></ol><p>Do you really wanna me to add some piece of code? Nope! You can clone it directly from my repo below :)</p><p><a href="https://github.com/f22labs/InstaLikeFragmentTransaction">f22labs/InstaLikeFragmentTransaction</a></p><p><strong>Credits:</strong></p><ol><li>Creator of Fragment back stack behaviour</li></ol><p><a href="https://github.com/ncapdevi/FragNav">GitHub - ncapdevi/FragNav: An Android library for managing multiple stacks of fragments</a></p><p>2. Inspired from Instagram Android app</p><p><a href="https://play.google.com/store/apps/details?id=com.instagram.android">Instagram - Apps on Google Play</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=389976fb8759" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/instagram-like-bottom-tab-fragment-transaction-android-389976fb8759">Instagram like Bottom tab Fragment Transaction Android</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reducing Intent data passing ‘putExtra’, ‘putInt’, ‘putParcelable’ Boiler plate code]]></title>
            <link>https://medium.com/f22labs/reducing-intent-data-passing-putextra-putint-putparcelable-boiler-plate-code-fd62b449dac3?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/fd62b449dac3</guid>
            <category><![CDATA[dart-and-henson]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android-intents]]></category>
            <category><![CDATA[android-activity]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Chandrasekar Kuppusamy]]></dc:creator>
            <pubDate>Wed, 03 May 2017 09:25:29 GMT</pubDate>
            <atom:updated>2017-05-15T13:32:03.324Z</atom:updated>
            <content:encoded><![CDATA[<p>Hey! We all know that passing datas between one Activity to another Activity is bit messy and tedious to handle in Android. Do you think that it can be processed in an easy way with less coding? Here it is, Dart and Henson</p><p><a href="https://github.com/f2prateek/dart">f2prateek/dart</a></p><h3><strong>Dart &amp; Henson:</strong></h3><p>Dart and Henson is an Android dependency Injection library to deal with Intent data passing without using cumbersome putParcelable, putInt, putString, putBundle key mechanism. It is a library created by a team of Groupon developers who presented article at DroidCon Italy 2017.</p><h3><strong>How to use?</strong></h3><p>The library setup is very simple and easy to use by just adding following Gradle dependencies:</p><pre>compile <strong>&#39;com.f2prateek.dart:dart:2.0.2&#39;<br></strong>annotationProcessor <strong>&#39;com.f2prateek.dart:dart-processor:2.0.2&#39;<br><br><br></strong>compile <strong>&#39;com.f2prateek.dart:henson:2.0.2&#39;<br></strong>annotationProcessor <strong>&#39;com.f2prateek.dart:henson-processor:2.0.2&#39;</strong></pre><p>That’s it you’re done to use Injection mechanism for Intent data sharing in your project.</p><h3><strong>Usages:</strong></h3><p>To simplify the usage, we can deal with two activities named:</p><ol><li>Source Activity — <strong>MainActivity.java</strong> (Activity where we’re gonna start <strong>DetailsActivity.java</strong> by passing intent datas like User (Parcelable data. It contains mobile, name, email fields), fromScreen (String data), isSuccess (boolean data))</li><li>Target Activity — <strong>DetailsActivity.java</strong> (Receiving Activity where we’re gonna receive and display the datas that are passed from <strong>MainActivity.java</strong>)</li></ol><h3><strong>Implementation:</strong></h3><h4><strong>What is Dart?</strong></h4><p>Extra “injection” library for Android which uses annotation processing to generate code that does direct field assignment of your extras in the Target Activity. In our case, we’re gonna Inject Dart in <strong>DetailsActivity.java</strong></p><p>Let’s start injecting variables using Dart</p><pre><strong>import </strong>android.os.Bundle;<br><strong>import </strong>android.support.annotation.Nullable;<br><strong>import </strong>android.support.v7.app.AppCompatActivity;<br><strong>import </strong>android.widget.Button;<br><strong>import </strong>android.widget.TextView;<br><br><strong>import </strong>com.f2prateek.dart.Dart;<br><strong>import </strong>com.f2prateek.dart.InjectExtra;<br><br><strong>import </strong>butterknife.BindView;<br><strong>import </strong>butterknife.ButterKnife;</pre><pre>@BindView(R.id.<strong><em>txt_mobile</em></strong>)<br>TextView <strong>txtMobile</strong>;<br>@BindView(R.id.<strong><em>txt_name</em></strong>)<br>TextView <strong>txtName</strong>;<br>@BindView(R.id.<strong><em>txt_email</em></strong>)<br>TextView <strong>txtEmail</strong>;<br>@BindView(R.id.<strong><em>btn_click_me</em></strong>)<br>Button <strong>btnClickMe</strong>;<br><br><br>@InjectExtra User <strong>user</strong>;</pre><pre>@Nullable<br>@InjectExtra String <strong>fromScreen</strong>;</pre><pre>@InjectExtra <strong>boolean isSuccess </strong>= <strong>false</strong>;</pre><pre>@Override<br><strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>    <strong>super</strong>.onCreate(savedInstanceState);<br>    setContentView(R.layout.<strong><em>activity_details</em></strong>);<br>    ButterKnife.<em>bind</em>(<strong>this</strong>);<br><br>    Dart.<em>inject</em>(<strong>this</strong>);<br>}</pre><p><strong>STEP 1:</strong> Make sure that you inject Dart in the Target Activity (<strong>DetailsActivity.java</strong>)</p><pre>Dart.<em>inject</em>(<strong>this</strong>);</pre><p><strong>STEP 2: </strong>Inject all the extras using<strong> @InjectExtra </strong>Annotations. In our case, we have Injected user (Parcelable), fromScreen (String) and isSuccess (boolean).</p><h4><strong>Optional Injection:</strong></h4><p>It is used to define whether a <strong>@InjectExtra</strong> is optional or not. In our case, we have made ‘<strong>fromScreen</strong>’ as optional by adding <strong>@Nullable</strong> annotations.</p><h4><strong>Default Values:</strong></h4><p>Declaring default values is even easy as similar to initialising global variables. In our case we have assigned default value as false for ‘<strong>isSuccess’ </strong>boolean.</p><p>Now we are done with the <strong>Dart</strong> TargetActivity setup.</p><h4>What is Henson?</h4><p>Henson is used to navigate between activities. In general, it should be used in the <strong>SourceActivity </strong>to start an Activity by passing Intent extras</p><p>Let’s call <strong>Henson</strong> method in <strong>MainActivity.java </strong>to start a<strong> DetailsActivity.java</strong></p><pre><strong>import </strong>android.content.Intent;<br><strong>import </strong>android.os.Bundle;<br><strong>import </strong>android.support.v7.app.AppCompatActivity;<br><strong>import </strong>android.widget.Button;<br><strong>import </strong>android.widget.EditText;<br><br><strong>import </strong>butterknife.BindView;<br><strong>import </strong>butterknife.ButterKnife;<br><strong>import </strong>butterknife.OnClick;<br><br><strong>public class </strong>MainActivity <strong>extends </strong>AppCompatActivity {<br><br>    @BindView(R.id.<strong><em>edt_mobile</em></strong>)<br>    EditText <strong>edtMobile</strong>;<br>    @BindView(R.id.<strong><em>edt_name</em></strong>)<br>    EditText <strong>edtName</strong>;<br>    @BindView(R.id.<strong><em>edt_email</em></strong>)<br>    EditText <strong>edtEmail</strong>;<br>    @BindView(R.id.<strong><em>btn_login</em></strong>)<br>    Button <strong>btnLogin</strong>;<br><br>    @Override<br>    <strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_main</em></strong>);<br>        ButterKnife.<em>bind</em>(<strong>this</strong>);<br><br>    }<br><br>    @OnClick(R.id.<strong><em>btn_login</em></strong>)<br>    <strong>public void </strong>onLoginClicked(){<br>        Intent intent = Henson.<em>with</em>(MainActivity.<strong>this</strong>)<br>                .gotoDetailsActivity()<br>                .build();<br>   }<br>}</pre><p>Yeah! Now Henson setup is done. Click <strong>Build</strong> — <strong>Rebuild Project</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rq7fjE3Na7in1XamdVjo-Q.png" /></figure><p>Chill! I know compiler throws Compilation error in .build() method as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Db93FC7qDQXg2DeIbIBIrw.png" /></figure><p>The reason behind this because we haven’t passed any @InjectExtra annotation methods which are created in <strong>DetailsActivity.java</strong></p><pre>@InjectExtra User <strong>user</strong>;<br>@Nullable<br>@InjectExtra String <strong>fromScreen</strong>;<br>@InjectExtra <strong>boolean isSuccess </strong>= <strong>false</strong>;</pre><p>Cool. Let’s add all the parameters in the Intent as</p><pre><strong>import </strong>android.content.Intent;<br><strong>import </strong>android.os.Bundle;<br><strong>import </strong>android.support.v7.app.AppCompatActivity;<br><strong>import </strong>android.widget.Button;<br><strong>import </strong>android.widget.EditText;<br><br><br><strong>import </strong>butterknife.BindView;<br><strong>import </strong>butterknife.ButterKnife;<br><strong>import </strong>butterknife.OnClick;<br><br><strong>public class </strong>MainActivity <strong>extends </strong>AppCompatActivity {<br><br>    @BindView(R.id.<strong><em>edt_mobile</em></strong>)<br>    EditText <strong>edtMobile</strong>;<br>    @BindView(R.id.<strong><em>edt_name</em></strong>)<br>    EditText <strong>edtName</strong>;<br>    @BindView(R.id.<strong><em>edt_email</em></strong>)<br>    EditText <strong>edtEmail</strong>;<br>    @BindView(R.id.<strong><em>btn_login</em></strong>)<br>    Button <strong>btnLogin</strong>;<br><br><br>    @Override<br>    <strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_main</em></strong>);<br>        ButterKnife.<em>bind</em>(<strong>this</strong>);<br><br>    }<br><br><br>    @OnClick(R.id.<strong><em>btn_login</em></strong>)<br>    <strong>public void </strong>onLoginClicked(){<br><br>        User user = <strong>new </strong>User();<br>        user.setEmail(<strong>edtEmail</strong>.getText().toString());<br>        user.setMobile(<strong>edtMobile</strong>.getText().toString());<br>        user.setName(<strong>edtName</strong>.getText().toString());<br><br>        Intent intent = Henson.<em>with</em>(MainActivity.<strong>this</strong>)<br>                .gotoDetailsActivity()<br>                .isSuccess(<strong>true</strong>)<br>                .user(user)<br>                .build();<br><br>        startActivity(intent);<br><br>    }<br>}</pre><p>Note: We haven’t passed <strong>fromScreen </strong>method since it is optional (By default it will be ‘null’).</p><p><strong>What is .gotoDetailsActivity()?</strong></p><p>I know everyone would be wondering from where this <strong>.gotoDetailsActivity()</strong> comes into the picture? Cool we have a answer for the same.</p><p><strong>goto</strong> (Henson generated appending string to start an <strong>Activity</strong>) + <strong>DetailsActivity</strong> (Our own <strong>TargetActivity</strong>).</p><p>Yeah! We’re almost done. Let’s play with the intents in the TargetActivity (<strong>DetailsActivity.java</strong>)</p><pre><strong>import </strong>android.content.Intent;<br><strong>import </strong>android.os.Bundle;<br><strong>import </strong>android.support.annotation.Nullable;<br><strong>import </strong>android.support.v7.app.AppCompatActivity;<br><strong>import </strong>android.widget.Button;<br><strong>import </strong>android.widget.TextView;<br><strong>import </strong>android.widget.Toast;<br><br><strong>import </strong>com.f2prateek.dart.Dart;<br><strong>import </strong>com.f2prateek.dart.InjectExtra;<br><br><strong>import </strong>butterknife.BindView;<br><strong>import </strong>butterknife.ButterKnife;<br><strong>import </strong>butterknife.OnClick;<br><br><strong>public class </strong>DetailsActivity <strong>extends </strong>AppCompatActivity {<br><br>    @BindView(R.id.<strong><em>txt_mobile</em></strong>)<br>    TextView <strong>txtMobile</strong>;<br>    @BindView(R.id.<strong><em>txt_name</em></strong>)<br>    TextView <strong>txtName</strong>;<br>    @BindView(R.id.<strong><em>txt_email</em></strong>)<br>    TextView <strong>txtEmail</strong>;<br>    @BindView(R.id.<strong><em>btn_click_me</em></strong>)<br>    Button <strong>btnClickMe</strong>;<br><br><br>    @InjectExtra User <strong>user</strong>;<br><br>    @Nullable<br>    @InjectExtra String <strong>fromScreen</strong>;<br><br>    @InjectExtra <strong>boolean isSuccess </strong>= <strong>false</strong>;<br><br>    @Override<br>    <strong>protected void </strong>onCreate(Bundle savedInstanceState) {<br>        <strong>super</strong>.onCreate(savedInstanceState);<br>        setContentView(R.layout.<strong><em>activity_details</em></strong>);<br>        ButterKnife.<em>bind</em>(<strong>this</strong>);<br><br>        Dart.<em>inject</em>(<strong>this</strong>);<br><br>        updateFields();<br>    }<br><br>    <strong>private void </strong>updateFields() {<br><br>        <strong>txtMobile</strong>.setText(<strong>user</strong>.getMobile());<br><br>        <strong>txtEmail</strong>.setText(<strong>user</strong>.getEmail());<br><br>        <strong>txtName</strong>.setText(<strong>user</strong>.getName());<br><br>    }<br><br>    @OnClick(R.id.<strong><em>btn_click_me</em></strong>)<br>    <strong>public void </strong>onClickMeClicked(){<br><br>        <strong>if</strong>(<strong>isSuccess</strong>){<br>            Toast.<em>makeText</em>(DetailsActivity.<strong>this</strong>, <strong>&quot;Dart and Henson is really working!&quot;</strong>, Toast.<strong><em>LENGTH_SHORT</em></strong>).show();<br>        }<br>    }<br><br>}</pre><p><strong>Download the code:</strong></p><p><a href="https://github.com/TakeoffAndroid/DartAndHensonDemo">TakeoffAndroid/DartAndHensonDemo</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*kHGR4D0JC-3slQpMKfxbTw.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd62b449dac3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/reducing-intent-data-passing-putextra-putint-putparcelable-boiler-plate-code-fd62b449dac3">Reducing Intent data passing ‘putExtra’, ‘putInt’, ‘putParcelable’ Boiler plate code</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Android Studio Plugins that will save you hundreds of hours]]></title>
            <link>https://medium.com/f22labs/5-android-studio-plugins-that-will-save-you-hundreds-of-hours-e740b2fed26?source=rss----5254d95312dc---4</link>
            <guid isPermaLink="false">https://medium.com/p/e740b2fed26</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Chandrasekar Kuppusamy]]></dc:creator>
            <pubDate>Mon, 13 Mar 2017 13:27:22 GMT</pubDate>
            <atom:updated>2017-03-13T13:27:22.132Z</atom:updated>
            <content:encoded><![CDATA[<p>Coding is fun! But being productive is more fun!. Here is a few list of few tools and Android Studio techniques which can save hundreds of your hours as an Android developer.</p><h4><strong>1. Android Code Generator</strong></h4><p>Are you a legacy Android developer and bored of writing the same view creations repeatedly even in your dreams? Yeah I was one too, but then I found this amazing plugin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XaP55MWeUrOkG4HrPJ1vmQ.png" /></figure><p><a href="https://plugins.jetbrains.com/plugin/7595-android-code-generator">Android Code Generator :: JetBrains Plugin Repository</a></p><h4><strong>2. GsonFormat</strong></h4><p>Its a lot of effort to build a model classes ( technically speaking POJO classes in Java ). But this tool makes it a breeze to do so. Just paste the JSON in the editor, and thats it, you’re done with your POJO’s !</p><p>Yeah ! It’s time to take a call with backend engineers for invalid responses ;-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*FCXPUrxIK5RvvgjxOvx_0A.png" /></figure><p><a href="https://plugins.jetbrains.com/plugin/7595-android-code-generator">Android Code Generator :: JetBrains Plugin Repository</a></p><h4>3. Android Parcelable Generator</h4><p>You’re done with POJO creation using GsonFormat, but how to send those from one Activity or fragment to another ?</p><p>Here is a solution to create a boiler plate Parcelable codes in a thunder fast way.</p><p>Thank me later ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*A9A77XfJNFzPfKbaQpOqMA.png" /></figure><p><a href="https://github.com/mcharmas/android-parcelable-intellij-plugin">mcharmas/android-parcelable-intellij-plugin</a></p><h4>4. Android ButterKnife Zelezny</h4><p>Everybody in Android circles is talking about using dependency injection framework in Android like ButterKnife, Dagger, PermissionDispatcher etc. But Android ButterKnife Zelezny occupies the first position by providing easiest way to wrap activity, fragment and adapter view creations in an elegant and dynamic way.</p><p>Click, Click and view objects are created. Without even typing anything !</p><p><a href="https://plugins.jetbrains.com/plugin/7369-android-butterknife-zelezny">Android ButterKnife Zelezny - Plugins | JetBrains</a></p><h4><strong>5. Live Templates</strong> — Write more code with keyboard shortcuts.</h4><p>Live Templates are code snippets that can be inserted into my code by typing their abbreviation and pressing tab. They live in the Editor section of the Preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLVKFVuT6hsX4wsgvLC15A.png" /></figure><p>Yup! you can configure your own code too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*h6PrJk0JCKPr9zBfrxX91g.gif" /></figure><p>So, what are you going to do with all that time saved ?</p><p>Imma gonna binge watch Narcos on Netflix !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e740b2fed26" width="1" height="1" alt=""><hr><p><a href="https://medium.com/f22labs/5-android-studio-plugins-that-will-save-you-hundreds-of-hours-e740b2fed26">5 Android Studio Plugins that will save you hundreds of hours</a> was originally published in <a href="https://medium.com/f22labs">F22 Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>