Hide notifications to the user when app is in background


#1

Hi,

I need my application receives push notifications in order to update the information that is locally stored. These notifications has to be received when the app is in foreground and in background without user interaction. Actually i have got the app receive push notifications in foreground without this user interaction but when the app is in background the push notification is shown by the phone and it has to be opened by the user in order the app receives the event of “notification arrived”.

What i need is a way to receive notifications in background and these are not visible for the user and, at the same time, are received by the app.

Any idea?

Thanks in advance


#2

I actually can’t think of a way where you would actually send a push notification, but don’t want the user to be able to see the notification? That fully beats the purpose of a push notification (which is a tell sign for the user there’s something there for them). Using them to trigger stuff in your app without the user knowing about it seems like a misusage of push notification to me.

What you’re actually looking for is a mechanism to trigger changes in your app without the user knowing. You could consider running the app in background mode, which you can give a notch and do your stuff. Or, just check every time the user opens up the app if there should be something done then.


#3

According with Firebase documentation (https://firebase.google.com/docs/cloud-messaging/concept-options) there is a type of notifications (data messages) used in order to send info to the app but not to the user. Maybe i have not understand the behaviour but it seems that the app have to be able to receive notifications without user interaction.


#4

Why you don’t just check on startup of your app if the data locally stored are up-to-date and if not, fetch them?


#5

Okay, didn’t know that! But what have you tried to set the key to data only (as per documentation)?


#6

The API development is closed, so i cannot create a nwe services. I’m trying to use push because i have not other alternative at this moment. Thanks.


#9

Yes, i have tried, but i’m not receiving push notifications when i set data key only.


#10

Well even if you will be able to push your notifications to your app without letting the user now (let’s say that possible) you would still have to trigger an action to fetch the data or even if you are able to send your data with the notification you still would need a way to get them and save them in the storage of your app…what I just want to display here is that in any case, you will need extra development…just a thought, take it or leave it of course :wink:

Good luck


#11

Thanks. I have implemented the process of update but i need a way to receive the notification (is my original question)