Is it possible to launch/waking up an app from background when push notification comes without required user click on notification tray? if possible then how? especially on IOS.. (sorry for bad English)
Asked
Active
Viewed 3,986 times
1

ReyAnthonyRenacia
- 17,219
- 5
- 37
- 56

Redha Putra
- 15
- 1
- 6
-
If your application is in the background, it can still run some logic but you cannot open the application itself as Dheeraj D says below. I use `react-native-push-notification` and more specifically the `onNotification` event. It gets passed a parameter which has a property `foreground` - here you can check if the notification has been received, and the app is in the foreground or background. – Dan Apr 04 '18 at 08:13
2 Answers
1
You cannot launch your app when push notification arrives without user interaction.
But you can wake up your app when device receives push notification. To do so you have to add content-available
key with value 1
in aps dictionary. For example
{
"aps" : {
"content-available" : 1
},
"acme1" : "bar",
"acme2" : 42
}
As you are using FCM to send push notification so it's payload will look something like this
{
"to" : "<device>",
"priority": "high",
"content_available": true, <-- this key is converted to 'content-available:1'
"notification" : {
"body" : "noti body",
"title" : "noti title",
"link": "noti link "
}
}
The important part here is content_available
and priority
.
And make sure that in project capabilities section enable Background modes and check remote notification.
References: Local and Remote Notification Programming Guide, Stackoverflow link1, Firebase FCM

Sunil Sharma
- 2,653
- 1
- 25
- 36
0
No it is not possible in iOS. You cannot launch an app without taping on Notification Banner or Just using APN.
-
thx for the answer, any references to launch an app in possible ways? – Redha Putra Apr 04 '18 at 07:49
-