I'm building an application where the user must complete a task within 5 minutes of receiving a local notification. If the task is completed then nothing happens but if the task is not completed then I need to run a parse cloud code function.
My issue is that if the user doesn't interact with the local notification I need to perform a parse cloud function. But I'm having a ton of difficulty trying to do this because of iOS's picky background modes and multitasking rules.
So far my app works great, but if the action is not completed and the user is not in the app I can't perform my code.
If anyone could point me in the right direction I would really appreciate it. If you need anymore details please let me know!
Cloud Code- This is the cloud code I would like to perform if the user does not complete the task within five minutes of reciving the local notifcation:
Parse.Cloud.define("chargeCustomer", function(request, response) {
Stripe.Charges.create({
amount: request.params['amount'],
currency: "usd",
customer: request.params['customerId']
}, {
success: function(customer) {
response.success(charge.id);
},
error: function(error) {
response.error("Error:" +error);
}
})
});
Thanks!