1 package expo.modules.interfaces.taskManager;
2 
3 import android.app.job.JobParameters;
4 import android.app.job.JobService;
5 import android.content.Intent;
6 
7 import java.util.Map;
8 
9 public interface TaskConsumerInterface {
10   /**
11    * Returns the type of the task, eg. "location" or "geofencing".
12    */
taskType()13   String taskType();
14 
15   /**
16    * Called once the task has been registered by the task service.
17    */
didRegister(TaskInterface task)18   void didRegister(TaskInterface task);
19 
20   /**
21    * Executed once the task associated with the consumer has been unregistered by the task service.
22    */
didUnregister()23   void didUnregister();
24 
25   /**
26    * Called when the task service has received a notification from the broadcast.
27    */
didReceiveBroadcast(Intent intent)28   void didReceiveBroadcast(Intent intent);
29 
30   /**
31    * Called when the scheduled job started its execution.
32    */
didExecuteJob(JobService jobService, JobParameters params)33   boolean didExecuteJob(JobService jobService, JobParameters params);
34 
35   /**
36    * Invoked when the scheduled job has been cancelled by the system.
37    */
didCancelJob(JobService jobService, JobParameters params)38   boolean didCancelJob(JobService jobService, JobParameters params);
39 
40   /**
41    * Called when registering already registered task with different options.
42    */
setOptions(Map<String, Object> options)43   void setOptions(Map<String, Object> options);
44 
45   /**
46    * Should return a boolean value whether the consumer can receive custom broadcast with given action.
47    */
canReceiveCustomBroadcast(String action)48   boolean canReceiveCustomBroadcast(String action);
49 }
50