Hi Rob,
Yes it should also start your app when the app is not running or suspended,
but it depends on heuristics of how much the user uses your app also
something to keep in mind is that:
If the user rebooted his device and never launched the app since the
reboot, the app will never wake up remotely and if the user killed the app
manually from the app switcher, the app will also never wake up remotely.
I created a small app similar to your use-case where I do a http request
when the content-available flag is set:
onNotification: function(event) {
if (event['content-available'] === 1) {
ajax({
url: "http://192.168.0.30:8888/index.php",
dataType: "text"
})
.then( function( result ) {
console.log(result);
push.setContentAvailable(push.FetchResult.NewData);
});
}
When I send a message with only content-available set like this:
~/w/t/background-fetch ❯❯❯ curl -u
"73795055-123-462d-a6dd-4ad514c3afbf:123456-617f-47d4-a03b-f9ce89b7ec2b"
\
-v -H "Accept: application/json" -H "Content-type: application/json"
\
-X POST -d \'{"message": {"content-available" : true}}'
\https://ups-me.rhcloud.com/ag-push/rest/sender
It sometimes calls my server, but not always and sometimes takes some time
to activate the app. Again this is something that apple implemented the app
is woken up / started by the os and there is nothing we can do about this.
You could also send a notification + content-available that way the
notification can be used to start the app or if there was no network the
app will react before the user 'touches' the app.
Hope this clears things up.