One behavior I see when using Google Hangouts is that when I'm in a conversation with person X and person Y sends a message, I can get a notification which I can check out later. Now, if I get a message from the person I'm speaking with then I simply don't get a notification.

In the current app I'm developing I can get the notifications when the app is not in use. It either has to be running on the background or not loaded at all. However, if I do get to be using the app then in "android" I will get a notification on the top but the notification will be gone since I'm using the app.

One thing I can do is the following:

document.addEventListener('push-notification', function(event) {
    if (event.notification.onStart) {
       console.log("The app was NOT in use.");
    } else {
       console.log("The app IN use");
    }
});

Is it possible to let android or ios know whether or not we can keep the notification? It could be that we are viewing certain data in the app and the notification may not be of importance in that view, when this is the case then we would like to keep the notification. I'm not sure if I'm missing something very simple, but from what I can tell, it should be since google Hangouts does it.

It seems that in ios it is not possible: http://stackoverflow.com/q/28453269

asked 13 Mar '15, 23:49
jmlopez's gravatar image

jmlopez
111

Hi,

On iOS, if the app is in the foreground, the push goes straight to the app, and there is no way to have it stored in the Notification center. The behavior of Android is quite similar, however, you may change it by creating the custom intent service inherited from the PushGCMIntentService:

If you need to handle custom notifications from your server, you should create a class extended from com.arellomobile.android.push.PushGCMIntentService, and include this custom intent service under the “PW_PUSH_SERVICE” tag in your manifest file.

permanent link
answered 17 Mar '15, 09:24
Benedict's gravatar image

Benedict
7127

edited 17 Mar '15, 09:24

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×446
×445
×352
×4

question asked: 13 Mar '15, 23:49

question was seen: 970 times

last updated: 17 Mar '15, 09:24