Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Check current state of the app

$
0
0

@coreelements wrote:

So I have a working demo of push notifications with AWS SNS Mobile Push tied with Apple.

I can register the device, pass the device token to my webserver. My webserver will add the token to the AWS SNS app. After that I can send a message to the endpoint (the subscriber).

My app has a listener to check if there's a notification .. for example

            $rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) {

                    var alertPopup = $ionicPopup.alert({
                      title: 'Notify',
                      template: 'got a notification!'
                    });

            });

So now I have 3 scenario's

1) The app is not running
When Apple sends the notification, my device will pick it up, and automaticly resolve it to the right app. I will get a nice alert notification and when I click on it, the app will be launched. Once launced, the event is triggered and I will get an Ionic alert.

2) The app is running, but not the active app at that moment
So again ... my device sees the notification, system notification alert is triggered AND my event is triggered (I will get an Ionic alert)

3) I'm in the app, so it's the current active app.
This time I'm doing random stuff on my app, the notification reaches my device, my app will trigger the event and I will get an Ionic alert.

The "problem" .. on step 3 , I don't want to show the alert, but need to do something else. So ... Is there a way to check if the notification reached my app when the app is the active app?

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles