<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dana A. White on Medium]]></title>
        <description><![CDATA[Stories by Dana A. White on Medium]]></description>
        <link>https://medium.com/@brightdanawhite?source=rss-a9b992952630------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BG19uy6sccPfjBfp.jpeg</url>
            <title>Stories by Dana A. White on Medium</title>
            <link>https://medium.com/@brightdanawhite?source=rss-a9b992952630------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 20:03:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brightdanawhite/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Push Notifications x React Native: A Retrospective]]></title>
            <link>https://medium.com/@brightdanawhite/push-notifications-x-react-native-a-retrospective-5b25e3074e8a?source=rss-a9b992952630------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b25e3074e8a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[push-notification]]></category>
            <dc:creator><![CDATA[Dana A. White]]></dc:creator>
            <pubDate>Wed, 30 Nov 2016 17:10:10 GMT</pubDate>
            <atom:updated>2016-12-01T21:18:05.125Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>It’s like a jungle sometimes, it makes me wonder how I keep from goin’ under — Melle Mel</blockquote><p>Hopefully, this will lighten the next developer’s load when he/she needs to venture into the world of finding a suitable push notifications platform for a React Native application.</p><p>Push Notifications can be hard…until you discover how simple they can be to implement. I discovered this recently when I embarked upon adding notifications to a recent project.</p><p>As I scoured the internets for solutions, I noticed a certain commonality — there is no shortage of resources to get one up to speed on how to create <a href="https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1">APNS</a> certificates (FYI, I’m speaking strictly from an iOS perspective today). Also, there are a few hosted backend solutions to ease the learning curve for a novice or someone who simply needs a quick and effective solution.</p><p>Initially, I decided to go with Parse as a backend. The reason for my decision was based on a theory that, although it Facebook had made a decision to <a href="http://blog.parse.com/announcements/moving-on/">open-source</a> the platform, it would still be the best solution for a React Native application. This was also due in part to the fact that I referred heavily to Facebook’s <a href="http://makeitopen.com/tutorials/building-the-f8-app/planning/">F8 application</a> for insight on React Native-specific concepts.</p><p>After ditching Parse (primarily due to complications related to support for Live Queries) and doing more due diligence, I decided to go with Firebase for my backend. With that being said, let’s get into the meat and potatoes of the subject of this writing: push notifications.</p><p>In order to keep things as simple as possible, I decided to go with a hosted backend instead of maintaining my own. After doing a bit of research, I discovered a few hosted solutions that provide Push Notification delivery. While <a href="https://firebase.google.com/docs/notifications/">Firebase</a>, <a href="https://go.urbanairship.com/apps/nvW5QOZPRNuN6GvD4JzrBQ/quickstart_guide/">Urban Airship</a> and <a href="https://documentation.onesignal.com/docs/notifications">OneSignal</a> are viable options that contain varying levels of descriptive documentation, I decided to go with OneSignal and access its API via the <a href="https://github.com/geektimecoil/react-native-onesignal">react-native-onesignal</a> library.</p><p>OneSignal allows the ability to send notifications (instantly or scheduled) via the console. However, I needed the ability to send remote notifications to a user’s device based on specific updates to the database. Local notifications are pretty straightforward and easily implemented via the <a href="https://facebook.github.io/react-native/docs/pushnotificationios.html">PushNotificationsIOS</a> module that comes with React Native. The main issue, however, with local notifications is that messages are displayed AFTER a user interacts with the application or if a user is currently using the app. I needed to implement remote notifications that would display during any time in which the app is in background mode.</p><p>After experiencing a brief bit of trepidation over the notion that I would have to write a <a href="https://nodejs.org/en/">Node</a>/<a href="http://expressjs.com/">Express</a> server in order to successfully implement this feature, I realized that I could simply use OneSignal’s Notifications API along with the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a>, which comes built into React Native. Here’s a example:</p><pre>sendRequestNotification(deviceIds, userInfo) {<br>    fetch(&#39;https://onesignal.com/api/v1/notifications&#39;, {<br>        method: &#39;post&#39;,<br>        headers: {<br>            &quot;Content-Type&quot;: &quot;application/json; charset=utf-8&quot;,<br>            &quot;Authorization&quot;: &quot;Basic &lt;Auth token&gt;&quot;<br>        },<br>        body: JSON.stringify({<br>            app_id: APP_ID,<br>            contents: {&quot;en&quot;: &quot;Some content&quot;},<br>            include_player_ids: [deviceIds]<br>        })<br>    }).then(res =&gt; console.log(&#39;success&#39;, res.json()))<br>      .catch(err =&gt; console.log(&#39;error&#39;, err))<br>}</pre><p>It’s that simple. OneSignal provides a bevy of attributes for you to add to the body object.</p><p>If you have any other questions about this, feel free to leave a comment. Also, do not hesitate to let me know if this article was helpful to you. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b25e3074e8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>