Skip to content

Commit

Permalink
Added example
Browse files Browse the repository at this point in the history
  • Loading branch information
shivang007 committed Oct 23, 2018
1 parent 8301ba7 commit fcd344e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion docs/ADVANCED.md
Expand Up @@ -439,4 +439,25 @@ Each category is a named object, snoozeRule and delete in this case. These names

## Force Starting App

When you implement the actionable notifications, you might notice that if the user has force closed his application, then the background actions will not work untill user opens the app the next time (Note: If you have used 'foreground': true, which will restart the app, this is not the intended behaviour for many providers). In this situation, 'forceStart' comes in handy. This will start the app again BUT the application will not be brought to foreground, hence it will not disrupt any task that the user was performing. In order to take advantage of this feature, you will need to be using cordova-android 6.0.0 or higher. If you add force-start: 1 to the data payload the application will be restarted in background even if it was force closed.
When you implement the actionable notifications, you might notice that if the user has force closed his application, then the background actions will not work untill user opens the app the next time (Note: If you have used 'foreground': true, which will restart the app, this is not the intended behaviour for many providers). In this situation, 'forceStart' comes in handy. This will start the app again BUT the application will not be brought to foreground, hence it will not disrupt any task that the user was performing. In order to take advantage of this feature, you will need to be using cordova-android 6.0.0 or higher. If you add force-start: 1 to the data payload the application will be restarted in background even if it was force closed.

Example:
```javascript
Push.send({
"from": 'push',
"title": "Test Notification for Force Start",
"text": "This will forcestart your app.",
"badge": 1,
"notId": 123456,
"query": {},
"apn": {
"sound": "www/application/app/testApp.wav"
},
"gcm": {
"sound": "testApp"
},
"forceStart": 1
});
```

Note: This is restricted to Android only. In IOS, once the user closes an app, you can not restart it forcefully unlike android.

0 comments on commit fcd344e

Please sign in to comment.