• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

Phone Notifications

Scheduled Pinned Locked Moved Utilities
97 Posts 31 Posters 129.3k Views 33 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    Oliver_Tooth
    last edited by May 6, 2017, 4:33 PM

    Hi,

    I’ve just installed your module for use with an iPhone. As I understand it, push-functionality is somewhat limited with Apple, but what can I expect this module to receive? Facebook messenger? Email? Calls/texts? Currently it doesn’t look like it’s receiving anything, but that may be because i’ve configured it wrong!

    Cheers!

    1 Reply Last reply Reply Quote 0
    • T Offline
      tnorling
      last edited by May 17, 2017, 10:39 PM

      So I had a few issues with this module that I think I was able to fix. The first issue I had was that the second notification gets posted several times. Second, when a notification from an app is already on the list, if a new notification from that app comes in it does not update or push it to the top. Finally, the top of the list is the oldest notification, not the newest. I came up with a solution that seems to work for me so far.

      In the phone_notification.js file update the cleanPayload function to look like this

      cleanPayload: function(newPayload){
              var application_name = newPayload.application_name;
              var that = this;
              var dupIndex = 0;
              if(this.payload.length > 0)
              {
                  this.payload.forEach(function (m) {
                      // If application_name already exists, increment notification count
                      if(m.application_name === application_name)
                      {
                          m.count++;
                          that.payload.splice(dupIndex,1);
                      }
                      dupIndex++;
                  });
              }
              
              this.payload.unshift(newPayload);
              this.payload.slice(0, this.config.displayCount -1);
          },
      

      Let me know if this helps or if you have any issues with it.

      S 1 Reply Last reply May 18, 2017, 2:34 AM Reply Quote 1
      • S Offline
        SypherDaemon @tnorling
        last edited by SypherDaemon May 18, 2017, 2:37 AM May 18, 2017, 2:34 AM

        @tnorling Hello there! I had almost given up hope on anyone turning up to help. Thanks so much. But just to follow-up I´ve replaced the CleanPayload function with yours and it seems to only allow one notification to appear, while ignoring others. The notification count also does not seem to increase despite giving myself missed calls. Thanks once again. Perhaps there are other segments that you have edited to make this work?

        T 1 Reply Last reply May 18, 2017, 2:42 AM Reply Quote 0
        • T Offline
          tnorling @SypherDaemon
          last edited by tnorling May 18, 2017, 2:45 AM May 18, 2017, 2:42 AM

          @SypherDaemon Interesting…what did you set your numberOfNotifications to in the config file? I have mine set to 3 and I am indeed showing 3 notifications at a time. I also just finished writing a function to remove notifications once they’ve been swiped away from your phone. Maybe I changed something somewhere else as well that made it all work. I’ll post my current working code shortly for you to test out.

          Edit: The count may no longer work because I am now replacing notifications coming from the same app. I’ll see what I can do to fix that next…

          S 1 Reply Last reply May 18, 2017, 2:54 AM Reply Quote 1
          • S Offline
            SypherDaemon @tnorling
            last edited by SypherDaemon May 18, 2017, 3:16 AM May 18, 2017, 2:54 AM

            @tnorling It’s fully working now, it was a mistake on my part. And yes I fully understand why the notification count isn’t increasing now, I was just using it to debug and see if the program was still accepting multiple notifications. Not really a loss from my end, as I’m not planning on using the notification count. But again, thank you so much. I’m gonna keep testing it out to see if there aren’t any unforseen side-effects.

            T 1 Reply Last reply May 18, 2017, 3:11 AM Reply Quote 0
            • T Offline
              tnorling @SypherDaemon
              last edited by May 18, 2017, 3:11 AM

              @SypherDaemon No problem! I’ve been wanting to use this for my own project so I’ve been trying to fix the issues I see with it. Most of the work was done by others, they deserve the credit on this one. I forked the original repo and uploaded my work if you’d like the dismissal feature as well.

              Link is Here

              S R 2 Replies Last reply May 18, 2017, 3:13 AM Reply Quote 1
              • S Offline
                SypherDaemon @tnorling
                last edited by SypherDaemon May 18, 2017, 3:16 AM May 18, 2017, 3:13 AM

                @tnorling I’m doing the same over on this side. I will definitely check it out. Good luck in your project!

                Edit: It turns out the problem earlier with the m.count++ was my own doing, my own mistake. Haha.

                1 Reply Last reply Reply Quote 1
                • R Offline
                  ronny3050 Module Developer @tnorling
                  last edited by May 18, 2017, 4:13 AM

                  @tnorling excellent work! Glad you could figure it out.

                  Once you’re good to go, would you mind submitting a pull request?

                  T 1 Reply Last reply May 18, 2017, 4:47 PM Reply Quote 0
                  • T Offline
                    tnorling @ronny3050
                    last edited by tnorling May 18, 2017, 5:08 PM May 18, 2017, 4:47 PM

                    @ronny3050 I submitted a pull request. A couple things to note: the notification count no longer works. In order to make it work it would need to increment on a notification being posted and decrement on dismissal. However, the dismissal information does not contain a field that differentiates between 2 notifications from the same application. So that means when a dismissal gets triggered on an app that has 2 or more active notifications it would remove all the notifications from that app making the count a useless number. This also means that when any notification from an app gets dismissed, even if it’s not the most recent, the notification from that app shown on the mirror get dismissed. I’ll look into this a little further but from what I’ve seen so far there doesn’t seem to be a way around it.

                    The second issue I’ve been running into is that there seems to be a server request error when notifications come in or get dismissed too quickly. It happens quietly in the background but if you find your phone blowing up with notifications, they may stop appearing on the mirror. We may need to incorporate a short waiting period between requests so it doesn’t lock up and miss incoming notifications.

                    Edit: I did actually figure out how to differentiate between notifications from the same app. I was just not paying close enough attention to the API haha. I guess the question now is whether or not the count is necessary since each notification would presumably have its own unique content. I can think of a way to do it if it’s a feature people want, but for my purposes it seems fine without.

                    R 1 Reply Last reply May 18, 2017, 5:41 PM Reply Quote 1
                    • R Offline
                      ronny3050 Module Developer @tnorling
                      last edited by ronny3050 May 18, 2017, 5:42 PM May 18, 2017, 5:41 PM

                      @tnorling I believe there is an ID associated with each notification that can help discriminate between two notifications from the same application.

                      For the second issue, I like the idea of a short waiting period. Another idea might be, albeit more complicated, is to have a notificationTimePeriod, say 45 seconds. If N notifications show up within 45 seconds, we will display the first notification in the notification area in the mirror, and slide subsequent ones with a delayNextNotification time period. That is, in the mirror, we will only use one item in the notification list to display all N notifications within a 45 second time period by sliding each of them with a delay.

                      Please let me know how this sounds. Thanks!

                      Edit: Sorry! Saw your edit late :b

                      T 1 Reply Last reply May 18, 2017, 7:11 PM Reply Quote 1
                      • 1
                      • 2
                      • 5
                      • 6
                      • 7
                      • 8
                      • 9
                      • 10
                      • 7 / 10
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy