Background Job

This tutorial is about schedule a background job to Android Device.

 

Step 1 – Add job to Cloud Code js file

Differ from the Cloud code, you can use Parse.Cloud.Define to define your function. But in background job, I need to declare job as Parse.Cloud.job.

Parse.Cloud.job("pushtest", function(request, response) {
 Parse.Push.send({
 channels: [ "" ],
 data: {
 alert: "Pushtest From Job"
 }
 }, { useMasterKey: true,
 success: function() {
 console.log("Pushed");
 // success!
 }, error: function(err) {
 console.log(err);
 }
 }); });

So this is the push notification schedule example, if you don’t know how to use cloud code or push notification

Please read Cloud Code Tutorial or Push Notifications.

 

Step 2 – Schedule your job

Screen Shot 2016-08-13 at 3.53.56 PM

 

Remind that Cloud job need to same as your Parse.Cloud.job(“name“)

Step 3 – Wait and check log to see is it working

 

This mean the code is fired.

Screen Shot 2016-08-13 at 3.49.24 PM

 

Screen Shot 2016-08-13 at 3.49.07 PMScreen Shot 2016-08-13 at 3.53.08 PM