Using push notifications to trigger code within Android app?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















Using a serverless architecture built on AWS, I'm looking for the best way to have users receive near-instant notifications of new "chats" within my Android app. I don't necessarily want to see a push notification appear in the phone's notification tray - I just want the app to listen for new messages, and update the view accordingly.



Here's my thinking: every time a user sends a chat, I'd basically trigger a Lambda function which would call SNS or IoT to publish the notification to any subscribed users of this chat.



But since SNS / IoT both work by sending "push notifications" to the phone, does that mean the message would have to appear within the phone's notification tray? I'm just looking for a way for my app to silently receive near-instant notifications from AWS and execute code to update its view.



Some other notes:



1) I don't want to build this using a server / EC2 with websocket listeners - I'd rather go serverless.



2) I've looked in Google's Firebase real-time DB which looks very capable, but as the rest of my architecture is on AWS, I'd like to stay there if possible










share|improve this question























  • Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

    – SREE
    Jan 3 at 9:16


















0















Using a serverless architecture built on AWS, I'm looking for the best way to have users receive near-instant notifications of new "chats" within my Android app. I don't necessarily want to see a push notification appear in the phone's notification tray - I just want the app to listen for new messages, and update the view accordingly.



Here's my thinking: every time a user sends a chat, I'd basically trigger a Lambda function which would call SNS or IoT to publish the notification to any subscribed users of this chat.



But since SNS / IoT both work by sending "push notifications" to the phone, does that mean the message would have to appear within the phone's notification tray? I'm just looking for a way for my app to silently receive near-instant notifications from AWS and execute code to update its view.



Some other notes:



1) I don't want to build this using a server / EC2 with websocket listeners - I'd rather go serverless.



2) I've looked in Google's Firebase real-time DB which looks very capable, but as the rest of my architecture is on AWS, I'd like to stay there if possible










share|improve this question























  • Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

    – SREE
    Jan 3 at 9:16














0












0








0








Using a serverless architecture built on AWS, I'm looking for the best way to have users receive near-instant notifications of new "chats" within my Android app. I don't necessarily want to see a push notification appear in the phone's notification tray - I just want the app to listen for new messages, and update the view accordingly.



Here's my thinking: every time a user sends a chat, I'd basically trigger a Lambda function which would call SNS or IoT to publish the notification to any subscribed users of this chat.



But since SNS / IoT both work by sending "push notifications" to the phone, does that mean the message would have to appear within the phone's notification tray? I'm just looking for a way for my app to silently receive near-instant notifications from AWS and execute code to update its view.



Some other notes:



1) I don't want to build this using a server / EC2 with websocket listeners - I'd rather go serverless.



2) I've looked in Google's Firebase real-time DB which looks very capable, but as the rest of my architecture is on AWS, I'd like to stay there if possible










share|improve this question














Using a serverless architecture built on AWS, I'm looking for the best way to have users receive near-instant notifications of new "chats" within my Android app. I don't necessarily want to see a push notification appear in the phone's notification tray - I just want the app to listen for new messages, and update the view accordingly.



Here's my thinking: every time a user sends a chat, I'd basically trigger a Lambda function which would call SNS or IoT to publish the notification to any subscribed users of this chat.



But since SNS / IoT both work by sending "push notifications" to the phone, does that mean the message would have to appear within the phone's notification tray? I'm just looking for a way for my app to silently receive near-instant notifications from AWS and execute code to update its view.



Some other notes:



1) I don't want to build this using a server / EC2 with websocket listeners - I'd rather go serverless.



2) I've looked in Google's Firebase real-time DB which looks very capable, but as the rest of my architecture is on AWS, I'd like to stay there if possible







android amazon-web-services lambda messaging serverless






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 3 at 7:28









darkrider1287darkrider1287

7718




7718













  • Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

    – SREE
    Jan 3 at 9:16



















  • Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

    – SREE
    Jan 3 at 9:16

















Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

– SREE
Jan 3 at 9:16





Just use Firebase and so you can manage onMessageReceived function in your app. You can even pass data to this function using FCM

– SREE
Jan 3 at 9:16












2 Answers
2






active

oldest

votes


















2














If you are making app for Android only, you can make use of the data message in FCM from Firebase. You can handle the message in onMessageReceived no matter your apps is on Foreground or Background.



Apart from that, firebase provide integration with most server side language. You should be able to send the message in your lambda function.






share|improve this answer































    1














    my suggestion is using FireBase...
    and make your Json tag with "data" than "Notification"






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018046%2fusing-push-notifications-to-trigger-code-within-android-app%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      If you are making app for Android only, you can make use of the data message in FCM from Firebase. You can handle the message in onMessageReceived no matter your apps is on Foreground or Background.



      Apart from that, firebase provide integration with most server side language. You should be able to send the message in your lambda function.






      share|improve this answer




























        2














        If you are making app for Android only, you can make use of the data message in FCM from Firebase. You can handle the message in onMessageReceived no matter your apps is on Foreground or Background.



        Apart from that, firebase provide integration with most server side language. You should be able to send the message in your lambda function.






        share|improve this answer


























          2












          2








          2







          If you are making app for Android only, you can make use of the data message in FCM from Firebase. You can handle the message in onMessageReceived no matter your apps is on Foreground or Background.



          Apart from that, firebase provide integration with most server side language. You should be able to send the message in your lambda function.






          share|improve this answer













          If you are making app for Android only, you can make use of the data message in FCM from Firebase. You can handle the message in onMessageReceived no matter your apps is on Foreground or Background.



          Apart from that, firebase provide integration with most server side language. You should be able to send the message in your lambda function.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 3 at 9:13









          Michael LamMichael Lam

          33628




          33628

























              1














              my suggestion is using FireBase...
              and make your Json tag with "data" than "Notification"






              share|improve this answer




























                1














                my suggestion is using FireBase...
                and make your Json tag with "data" than "Notification"






                share|improve this answer


























                  1












                  1








                  1







                  my suggestion is using FireBase...
                  and make your Json tag with "data" than "Notification"






                  share|improve this answer













                  my suggestion is using FireBase...
                  and make your Json tag with "data" than "Notification"







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 3 at 9:07









                  morten jonathanmorten jonathan

                  307




                  307






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54018046%2fusing-push-notifications-to-trigger-code-within-android-app%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      MongoDB - Not Authorized To Execute Command

                      How to fix TextFormField cause rebuild widget in Flutter

                      in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith