Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch an app with push notification after it has been terminated

Tags:

ios

swift

I was wondering if there was a way to wake up an app that has been terminated by the user on ios8-9. By terminated I mean double click on the home button and swipe up.

Is it somehow possible to launch an app by sending a silent push notification so that didreceiveremotenotification gets fired and gives me some runtime ?

I have noticed that a fair share of my users terminate my app. As I rely heavily on background fetch, this a problem. My idea was to send silent push notifications to launch the app in the background and trigger background fetch.

like image 390
anto0522 Avatar asked Aug 27 '15 23:08

anto0522


People also ask

Do push notifications work when app is closed?

Let's start with Android. The Android OS is designed to listen for push messages and upon receiving one, wake up the appropriate Android app to handle the push message, regardless of whether the app is closed or not.

How do I get push notifications back?

Once you're in the Settings app, tap Notifications. In the resulting screen (Figure 1), tap Notifications. Accessing the Notification History in Android 12. In the next window (Figure 2), enable the Notification History by tapping the On/Off slider until it's in the On position.

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.

Does an app need to be open for push notifications?

Push notifications can be sent without the app requiring the user's contact information (note that the app must first ask the user for permission in order to send push notifications).


1 Answers

Short Answer: No That is not possible.

Detail:

When there is any new content on server you will send Remote Notification to your application to inform about that. (A Remote Notification is really just a normal Push Notification with the content-available flag set)

When application received this Remote Notification it calls following method:

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler

In Documentation of this method it is clearly written:

However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.

Reference:

like image 141
CRDave Avatar answered Nov 03 '22 01:11

CRDave