<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: IssueResolver-collab</title>
    <description>The latest articles on DEV Community by IssueResolver-collab (@issueresolvercollab).</description>
    <link>https://dev.to/issueresolvercollab</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F596607%2F7514c715-14bc-4262-9e61-843cd21becfc.jpg</url>
      <title>DEV Community: IssueResolver-collab</title>
      <link>https://dev.to/issueresolvercollab</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/issueresolvercollab"/>
    <language>en</language>
    <item>
      <title>AWS SNS(Simple Notification Service) notifications not getting delivered to device??</title>
      <dc:creator>IssueResolver-collab</dc:creator>
      <pubDate>Mon, 15 Mar 2021 11:23:30 +0000</pubDate>
      <link>https://dev.to/issueresolvercollab/aws-sns-simple-notification-service-notifications-not-getting-delivered-to-device-3nmj</link>
      <guid>https://dev.to/issueresolvercollab/aws-sns-simple-notification-service-notifications-not-getting-delivered-to-device-3nmj</guid>
      <description>&lt;p&gt;&lt;em&gt;Have you ever came across such issue where your AWS SNS messages sent from AWS console not displaying on your mobile device?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If your answer is YES, then you are at right place&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In this article we will focus on how to resolve this issue:&lt;/p&gt;

&lt;p&gt;Prerequisites : &lt;br&gt;
1)You have done all AWS SNS configuration(created AWS SNS topic,created platform application,created platform application endpoint and added endpoint as subscriber of topic)&lt;br&gt;
2)registered your app and device with FCM and AWS SNS.&lt;/p&gt;

&lt;p&gt;Source : &lt;a href="https://docs.aws.amazon.com/sns/latest/dg/sns-send-custom-platform-specific-payloads-mobile-devices.html"&gt;Link&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to AWS console&lt;/li&gt;
&lt;li&gt;Go to the SNS topic that you created earlier&lt;/li&gt;
&lt;li&gt;Click on publish message button on top right corner.&lt;/li&gt;
&lt;li&gt;Here a page will open up as shown below.Select "Custom payload for each delivery protocol" radio button.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dTw3W0DR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w59lt4ozpd272on1vz39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dTw3W0DR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w59lt4ozpd272on1vz39.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now you can go to &lt;a href="https://docs.aws.amazon.com/sns/latest/dg/sns-send-custom-platform-specific-payloads-mobile-devices.html"&gt;Link&lt;/a&gt;
and select the platform-specific message format.
in my case I used GCM format as shown above&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that default fallback message is compulsory to give in json body. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;in my case I added payload as&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
  "GCM":"{ \"notification\": { \"body\": \"Sample message for Android endpoints\", \"title\":\"TitleTest\" } }"&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now check your device for notifications&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Thanks for reading this article.&lt;/p&gt;

&lt;p&gt;Let me know in comment section.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>react-native-push-notifications (handling foreground push notifications)</title>
      <dc:creator>IssueResolver-collab</dc:creator>
      <pubDate>Mon, 15 Mar 2021 09:59:16 +0000</pubDate>
      <link>https://dev.to/issueresolvercollab/react-native-push-notifications-handling-foreground-push-notifications-202p</link>
      <guid>https://dev.to/issueresolvercollab/react-native-push-notifications-handling-foreground-push-notifications-202p</guid>
      <description>&lt;p&gt;&lt;em&gt;Ever wondered why push-notifications are not getting displayed when your app is in foreground ???&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If your answer is yes,then you are at the right place!!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here you go&lt;/p&gt;

&lt;p&gt;So recently I faced one issue while implementing push notifications in my app using AWS SNS, firebase cloud messaging (FCM).&lt;/p&gt;

&lt;p&gt;Firstly I thought that there is some issue with my AWS SNS configuration.&lt;/p&gt;

&lt;p&gt;After digging into this issue I finally found that there is issue with the way I configured my react-native-push-notifications library in my react-native code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites : You have configured your react-native app as shown in below link :&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/zo0r/react-native-push-notification"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create a new React component (RemotePushController.js)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useEffect } from 'react';
import PushNotification from "react-native-push-notification";


const RemotePushController = () =&amp;gt;{
    useEffect(()=&amp;gt;{
        PushNotification.configure({

            onRegister: function (token) {
              console.log('TOKEN:', token);
            },

            onNotification: function (notification) {
              console.log('NOTIFICATION:', notification);

            if (notification.foreground) {
            PushNotification.localNotification({
              title:notification.title,
              message:notification.message
            });
            } 
            },

            senderID: "your_fcm_sender_id_here",

            permissions: {
              alert: true,
              badge: true,Consent
              sound: true
            },

            popInitialNotification: true,

            requestPermissions: true,
          });
    },[]);

    return null;
};

export default RemotePushController;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now inside your App.js file include the RemotePushController component as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const App = () =&amp;gt; {
  return (
    &amp;lt;View&amp;gt;
      &amp;lt;RemotePushController/&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;In case suppose your root component is Provider from react-redux library then add it as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const App = () =&amp;gt; {
  return (
    &amp;lt;Provider store={store}&amp;gt;
      &amp;lt;RemotePushController/&amp;gt;
    &amp;lt;/Provider&amp;gt;
  );
};

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

&lt;/div&gt;



&lt;p&gt;So the basic idea is just add RemotePushController component above the ending root tag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So the important part you need to keep in mind is adding following code in PushNotification.configure() as below:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  onNotification: function (notification) {
   console.log('NOTIFICATION:', notification);

   if (notification.foreground) {
       PushNotification.localNotification({
           title:notification.title,
           message:notification.message
       });
    } 
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it!!!!&lt;br&gt;
Now you are good to go.&lt;br&gt;
Now just run your react-native app again and try sending push notifications while your app is running in foreground.&lt;/p&gt;

&lt;p&gt;Let me know in comment section&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>reactnative</category>
    </item>
  </channel>
</rss>
