setService(java.lang.Class) in Builder cannot be applied to (java.lang.Class)
Description
I want to build notification app which app provide notification every 15 minutes.
Build this app i use FirebaseJobDispatcher job scheduler.But when i build my job using newJobBuilder(). but this time when i use setService() method then i got compile time error.I can not fix it. I have searched for an appropriate solution over the web but didn't find anything useful. Please help me.
My Exception
setService
(java.lang.Class)
in Builder cannot be applied
to
(java.lang.Class)
Photo
My WaterReminderFirebaseJobService Class
package com.example.android.background.sync;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Context;
import android.os.AsyncTask;
import com.firebase.jobdispatcher.RetryStrategy;
public class WaterReminderFirebaseJobService extends JobService {
private AsyncTask mBackgroundTask;
/**
* The entry point to your Job. Implementations should offload work to another thread of
* execution as soon as possible.
*
* This is called by the Job Dispatcher to tell us we should start our job. Keep in mind this
* method is run on the application's main thread, so we need to offload work to a background
* thread.
*
* @return whether there is more work remaining.
*/
@Override
public boolean onStartJob(final JobParameters jobParameters) {
// AsyncTask called mBackgroundTask.
// Here's where we make an AsyncTask so that this is no longer on the main thread
mBackgroundTask = new AsyncTask() {
// COMPLETED (6) Override doInBackground
@Override
protected Object doInBackground(Object params) {
// COMPLETED (7) Use ReminderTasks to execute the new charging reminder task you made, use
// this service as the context (WaterReminderFirebaseJobService.this) and return null
// when finished.
Context context = WaterReminderFirebaseJobService.this;
ReminderTasks.executeTask(context, ReminderTasks.ACTION_CHARGING_REMINDER);
return null;
}
@Override
protected void onPostExecute(Object o) {
// COMPLETED (8) Override onPostExecute and called jobFinished. Pass the job parameters
// and false to jobFinished. This will inform the JobManager that your job is done
// and that you do not want to reschedule the job.
/*
* Once the AsyncTask is finished, the job is finished. To inform JobManager that
* you're done, you call jobFinished with the jobParamters that were passed to your
* job and a boolean representing whether the job needs to be rescheduled. This is
* usually if something didn't work and you want the job to try running again.
*/
jobFinished(jobParameters, false);
}
};
mBackgroundTask.execute();
return true;
}
/**
* Called when the scheduling engine has decided to interrupt the execution of a running job,
* most likely because the runtime constraints associated with the job are no longer satisfied.
*
* @return whether the job should be retried
* @see RetryStrategy
*/
@Override
public boolean onStopJob(JobParameters jobParameters) {
if (mBackgroundTask != null) mBackgroundTask.cancel(true);
return true;
}
}
My ReminderUtils Class
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background.sync;
import android.content.Context;
import android.support.annotation.NonNull;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.Driver;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.Trigger;
import java.util.concurrent.TimeUnit;
public class ReminderUtilities {
private static final int REMINDER_INTERVAL_MINUTES=1;
private static final int REMINDER_INTERVAL_SECONDS=(int)(TimeUnit.MINUTES.toSeconds(REMINDER_INTERVAL_MINUTES));
private static final int SYNC_FLEXTIME_SECONDS=REMINDER_INTERVAL_SECONDS;
private static final String REMINDER_JOB_TAG="hydration_reminder_tag";
private static boolean sInitialized;
synchronized public static void scheduleChargingReminder(@NonNull final Context context){
if(sInitialized) return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
/* Create the Job to periodically create reminders to drink water */
Job constraintReminderJob = dispatcher.newJobBuilder()
/* The Service that will be used to write to preferences */
.setService(WaterReminderFirebaseJobService.class)
/*
* Set the UNIQUE tag used to identify this Job.
*/
.setTag(REMINDER_JOB_TAG)
/*
* Network constraints on which this Job should run. In this app, we're using the
* device charging constraint so that the job only executes if the device is
* charging.
*
* In a normal app, it might be a good idea to include a preference for this,
* as different users may have different preferences on when you should be
* syncing your application's data.
*/
.setConstraints(Constraint.DEVICE_CHARGING)
/*
* setLifetime sets how long this job should persist. The options are to keep the
* Job "forever" or to have it die the next time the device boots up.
*/
.setLifetime(Lifetime.FOREVER)
/*
* We want these reminders to continuously happen, so we tell this Job to recur.
*/
.setRecurring(true)
/*
* We want the reminders to happen every 15 minutes or so. The first argument for
* Trigger class's static executionWindow method is the start of the time frame
* when the
* job should be performed. The second argument is the latest point in time at
* which the data should be synced. Please note that this end time is not
* guaranteed, but is more of a guideline for FirebaseJobDispatcher to go off of.
*/
.setTrigger(Trigger.executionWindow(
REMINDER_INTERVAL_SECONDS,
REMINDER_INTERVAL_SECONDS + SYNC_FLEXTIME_SECONDS))
/*
* If a Job with the tag with provided already exists, this new job will replace
* the old one.
*/
.setReplaceCurrent(true)
/* Once the Job is ready, call the builder's build method to return the Job */
.build();
/* Schedule the Job with the dispatcher */
dispatcher.schedule(constraintReminderJob);
/* The job has been initialized */
sInitialized = true;
}
}
java android android-jobscheduler firebase-job-dispatcher
add a comment |
Description
I want to build notification app which app provide notification every 15 minutes.
Build this app i use FirebaseJobDispatcher job scheduler.But when i build my job using newJobBuilder(). but this time when i use setService() method then i got compile time error.I can not fix it. I have searched for an appropriate solution over the web but didn't find anything useful. Please help me.
My Exception
setService
(java.lang.Class)
in Builder cannot be applied
to
(java.lang.Class)
Photo
My WaterReminderFirebaseJobService Class
package com.example.android.background.sync;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Context;
import android.os.AsyncTask;
import com.firebase.jobdispatcher.RetryStrategy;
public class WaterReminderFirebaseJobService extends JobService {
private AsyncTask mBackgroundTask;
/**
* The entry point to your Job. Implementations should offload work to another thread of
* execution as soon as possible.
*
* This is called by the Job Dispatcher to tell us we should start our job. Keep in mind this
* method is run on the application's main thread, so we need to offload work to a background
* thread.
*
* @return whether there is more work remaining.
*/
@Override
public boolean onStartJob(final JobParameters jobParameters) {
// AsyncTask called mBackgroundTask.
// Here's where we make an AsyncTask so that this is no longer on the main thread
mBackgroundTask = new AsyncTask() {
// COMPLETED (6) Override doInBackground
@Override
protected Object doInBackground(Object params) {
// COMPLETED (7) Use ReminderTasks to execute the new charging reminder task you made, use
// this service as the context (WaterReminderFirebaseJobService.this) and return null
// when finished.
Context context = WaterReminderFirebaseJobService.this;
ReminderTasks.executeTask(context, ReminderTasks.ACTION_CHARGING_REMINDER);
return null;
}
@Override
protected void onPostExecute(Object o) {
// COMPLETED (8) Override onPostExecute and called jobFinished. Pass the job parameters
// and false to jobFinished. This will inform the JobManager that your job is done
// and that you do not want to reschedule the job.
/*
* Once the AsyncTask is finished, the job is finished. To inform JobManager that
* you're done, you call jobFinished with the jobParamters that were passed to your
* job and a boolean representing whether the job needs to be rescheduled. This is
* usually if something didn't work and you want the job to try running again.
*/
jobFinished(jobParameters, false);
}
};
mBackgroundTask.execute();
return true;
}
/**
* Called when the scheduling engine has decided to interrupt the execution of a running job,
* most likely because the runtime constraints associated with the job are no longer satisfied.
*
* @return whether the job should be retried
* @see RetryStrategy
*/
@Override
public boolean onStopJob(JobParameters jobParameters) {
if (mBackgroundTask != null) mBackgroundTask.cancel(true);
return true;
}
}
My ReminderUtils Class
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background.sync;
import android.content.Context;
import android.support.annotation.NonNull;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.Driver;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.Trigger;
import java.util.concurrent.TimeUnit;
public class ReminderUtilities {
private static final int REMINDER_INTERVAL_MINUTES=1;
private static final int REMINDER_INTERVAL_SECONDS=(int)(TimeUnit.MINUTES.toSeconds(REMINDER_INTERVAL_MINUTES));
private static final int SYNC_FLEXTIME_SECONDS=REMINDER_INTERVAL_SECONDS;
private static final String REMINDER_JOB_TAG="hydration_reminder_tag";
private static boolean sInitialized;
synchronized public static void scheduleChargingReminder(@NonNull final Context context){
if(sInitialized) return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
/* Create the Job to periodically create reminders to drink water */
Job constraintReminderJob = dispatcher.newJobBuilder()
/* The Service that will be used to write to preferences */
.setService(WaterReminderFirebaseJobService.class)
/*
* Set the UNIQUE tag used to identify this Job.
*/
.setTag(REMINDER_JOB_TAG)
/*
* Network constraints on which this Job should run. In this app, we're using the
* device charging constraint so that the job only executes if the device is
* charging.
*
* In a normal app, it might be a good idea to include a preference for this,
* as different users may have different preferences on when you should be
* syncing your application's data.
*/
.setConstraints(Constraint.DEVICE_CHARGING)
/*
* setLifetime sets how long this job should persist. The options are to keep the
* Job "forever" or to have it die the next time the device boots up.
*/
.setLifetime(Lifetime.FOREVER)
/*
* We want these reminders to continuously happen, so we tell this Job to recur.
*/
.setRecurring(true)
/*
* We want the reminders to happen every 15 minutes or so. The first argument for
* Trigger class's static executionWindow method is the start of the time frame
* when the
* job should be performed. The second argument is the latest point in time at
* which the data should be synced. Please note that this end time is not
* guaranteed, but is more of a guideline for FirebaseJobDispatcher to go off of.
*/
.setTrigger(Trigger.executionWindow(
REMINDER_INTERVAL_SECONDS,
REMINDER_INTERVAL_SECONDS + SYNC_FLEXTIME_SECONDS))
/*
* If a Job with the tag with provided already exists, this new job will replace
* the old one.
*/
.setReplaceCurrent(true)
/* Once the Job is ready, call the builder's build method to return the Job */
.build();
/* Schedule the Job with the dispatcher */
dispatcher.schedule(constraintReminderJob);
/* The job has been initialized */
sInitialized = true;
}
}
java android android-jobscheduler firebase-job-dispatcher
The class is asking for a class that extendscom.firebase.jobdispatcher.JobService
and you are providing it a class that extendsandroid.app.job.JobService
– Compass
Nov 19 '18 at 20:45
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56
add a comment |
Description
I want to build notification app which app provide notification every 15 minutes.
Build this app i use FirebaseJobDispatcher job scheduler.But when i build my job using newJobBuilder(). but this time when i use setService() method then i got compile time error.I can not fix it. I have searched for an appropriate solution over the web but didn't find anything useful. Please help me.
My Exception
setService
(java.lang.Class)
in Builder cannot be applied
to
(java.lang.Class)
Photo
My WaterReminderFirebaseJobService Class
package com.example.android.background.sync;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Context;
import android.os.AsyncTask;
import com.firebase.jobdispatcher.RetryStrategy;
public class WaterReminderFirebaseJobService extends JobService {
private AsyncTask mBackgroundTask;
/**
* The entry point to your Job. Implementations should offload work to another thread of
* execution as soon as possible.
*
* This is called by the Job Dispatcher to tell us we should start our job. Keep in mind this
* method is run on the application's main thread, so we need to offload work to a background
* thread.
*
* @return whether there is more work remaining.
*/
@Override
public boolean onStartJob(final JobParameters jobParameters) {
// AsyncTask called mBackgroundTask.
// Here's where we make an AsyncTask so that this is no longer on the main thread
mBackgroundTask = new AsyncTask() {
// COMPLETED (6) Override doInBackground
@Override
protected Object doInBackground(Object params) {
// COMPLETED (7) Use ReminderTasks to execute the new charging reminder task you made, use
// this service as the context (WaterReminderFirebaseJobService.this) and return null
// when finished.
Context context = WaterReminderFirebaseJobService.this;
ReminderTasks.executeTask(context, ReminderTasks.ACTION_CHARGING_REMINDER);
return null;
}
@Override
protected void onPostExecute(Object o) {
// COMPLETED (8) Override onPostExecute and called jobFinished. Pass the job parameters
// and false to jobFinished. This will inform the JobManager that your job is done
// and that you do not want to reschedule the job.
/*
* Once the AsyncTask is finished, the job is finished. To inform JobManager that
* you're done, you call jobFinished with the jobParamters that were passed to your
* job and a boolean representing whether the job needs to be rescheduled. This is
* usually if something didn't work and you want the job to try running again.
*/
jobFinished(jobParameters, false);
}
};
mBackgroundTask.execute();
return true;
}
/**
* Called when the scheduling engine has decided to interrupt the execution of a running job,
* most likely because the runtime constraints associated with the job are no longer satisfied.
*
* @return whether the job should be retried
* @see RetryStrategy
*/
@Override
public boolean onStopJob(JobParameters jobParameters) {
if (mBackgroundTask != null) mBackgroundTask.cancel(true);
return true;
}
}
My ReminderUtils Class
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background.sync;
import android.content.Context;
import android.support.annotation.NonNull;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.Driver;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.Trigger;
import java.util.concurrent.TimeUnit;
public class ReminderUtilities {
private static final int REMINDER_INTERVAL_MINUTES=1;
private static final int REMINDER_INTERVAL_SECONDS=(int)(TimeUnit.MINUTES.toSeconds(REMINDER_INTERVAL_MINUTES));
private static final int SYNC_FLEXTIME_SECONDS=REMINDER_INTERVAL_SECONDS;
private static final String REMINDER_JOB_TAG="hydration_reminder_tag";
private static boolean sInitialized;
synchronized public static void scheduleChargingReminder(@NonNull final Context context){
if(sInitialized) return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
/* Create the Job to periodically create reminders to drink water */
Job constraintReminderJob = dispatcher.newJobBuilder()
/* The Service that will be used to write to preferences */
.setService(WaterReminderFirebaseJobService.class)
/*
* Set the UNIQUE tag used to identify this Job.
*/
.setTag(REMINDER_JOB_TAG)
/*
* Network constraints on which this Job should run. In this app, we're using the
* device charging constraint so that the job only executes if the device is
* charging.
*
* In a normal app, it might be a good idea to include a preference for this,
* as different users may have different preferences on when you should be
* syncing your application's data.
*/
.setConstraints(Constraint.DEVICE_CHARGING)
/*
* setLifetime sets how long this job should persist. The options are to keep the
* Job "forever" or to have it die the next time the device boots up.
*/
.setLifetime(Lifetime.FOREVER)
/*
* We want these reminders to continuously happen, so we tell this Job to recur.
*/
.setRecurring(true)
/*
* We want the reminders to happen every 15 minutes or so. The first argument for
* Trigger class's static executionWindow method is the start of the time frame
* when the
* job should be performed. The second argument is the latest point in time at
* which the data should be synced. Please note that this end time is not
* guaranteed, but is more of a guideline for FirebaseJobDispatcher to go off of.
*/
.setTrigger(Trigger.executionWindow(
REMINDER_INTERVAL_SECONDS,
REMINDER_INTERVAL_SECONDS + SYNC_FLEXTIME_SECONDS))
/*
* If a Job with the tag with provided already exists, this new job will replace
* the old one.
*/
.setReplaceCurrent(true)
/* Once the Job is ready, call the builder's build method to return the Job */
.build();
/* Schedule the Job with the dispatcher */
dispatcher.schedule(constraintReminderJob);
/* The job has been initialized */
sInitialized = true;
}
}
java android android-jobscheduler firebase-job-dispatcher
Description
I want to build notification app which app provide notification every 15 minutes.
Build this app i use FirebaseJobDispatcher job scheduler.But when i build my job using newJobBuilder(). but this time when i use setService() method then i got compile time error.I can not fix it. I have searched for an appropriate solution over the web but didn't find anything useful. Please help me.
My Exception
setService
(java.lang.Class)
in Builder cannot be applied
to
(java.lang.Class)
Photo
My WaterReminderFirebaseJobService Class
package com.example.android.background.sync;
import android.app.job.JobParameters;
import android.app.job.JobService;
import android.content.Context;
import android.os.AsyncTask;
import com.firebase.jobdispatcher.RetryStrategy;
public class WaterReminderFirebaseJobService extends JobService {
private AsyncTask mBackgroundTask;
/**
* The entry point to your Job. Implementations should offload work to another thread of
* execution as soon as possible.
*
* This is called by the Job Dispatcher to tell us we should start our job. Keep in mind this
* method is run on the application's main thread, so we need to offload work to a background
* thread.
*
* @return whether there is more work remaining.
*/
@Override
public boolean onStartJob(final JobParameters jobParameters) {
// AsyncTask called mBackgroundTask.
// Here's where we make an AsyncTask so that this is no longer on the main thread
mBackgroundTask = new AsyncTask() {
// COMPLETED (6) Override doInBackground
@Override
protected Object doInBackground(Object params) {
// COMPLETED (7) Use ReminderTasks to execute the new charging reminder task you made, use
// this service as the context (WaterReminderFirebaseJobService.this) and return null
// when finished.
Context context = WaterReminderFirebaseJobService.this;
ReminderTasks.executeTask(context, ReminderTasks.ACTION_CHARGING_REMINDER);
return null;
}
@Override
protected void onPostExecute(Object o) {
// COMPLETED (8) Override onPostExecute and called jobFinished. Pass the job parameters
// and false to jobFinished. This will inform the JobManager that your job is done
// and that you do not want to reschedule the job.
/*
* Once the AsyncTask is finished, the job is finished. To inform JobManager that
* you're done, you call jobFinished with the jobParamters that were passed to your
* job and a boolean representing whether the job needs to be rescheduled. This is
* usually if something didn't work and you want the job to try running again.
*/
jobFinished(jobParameters, false);
}
};
mBackgroundTask.execute();
return true;
}
/**
* Called when the scheduling engine has decided to interrupt the execution of a running job,
* most likely because the runtime constraints associated with the job are no longer satisfied.
*
* @return whether the job should be retried
* @see RetryStrategy
*/
@Override
public boolean onStopJob(JobParameters jobParameters) {
if (mBackgroundTask != null) mBackgroundTask.cancel(true);
return true;
}
}
My ReminderUtils Class
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.android.background.sync;
import android.content.Context;
import android.support.annotation.NonNull;
import com.firebase.jobdispatcher.Constraint;
import com.firebase.jobdispatcher.Driver;
import com.firebase.jobdispatcher.FirebaseJobDispatcher;
import com.firebase.jobdispatcher.GooglePlayDriver;
import com.firebase.jobdispatcher.Job;
import com.firebase.jobdispatcher.Lifetime;
import com.firebase.jobdispatcher.Trigger;
import java.util.concurrent.TimeUnit;
public class ReminderUtilities {
private static final int REMINDER_INTERVAL_MINUTES=1;
private static final int REMINDER_INTERVAL_SECONDS=(int)(TimeUnit.MINUTES.toSeconds(REMINDER_INTERVAL_MINUTES));
private static final int SYNC_FLEXTIME_SECONDS=REMINDER_INTERVAL_SECONDS;
private static final String REMINDER_JOB_TAG="hydration_reminder_tag";
private static boolean sInitialized;
synchronized public static void scheduleChargingReminder(@NonNull final Context context){
if(sInitialized) return;
Driver driver=new GooglePlayDriver(context);
FirebaseJobDispatcher dispatcher=new FirebaseJobDispatcher(driver);
/* Create the Job to periodically create reminders to drink water */
Job constraintReminderJob = dispatcher.newJobBuilder()
/* The Service that will be used to write to preferences */
.setService(WaterReminderFirebaseJobService.class)
/*
* Set the UNIQUE tag used to identify this Job.
*/
.setTag(REMINDER_JOB_TAG)
/*
* Network constraints on which this Job should run. In this app, we're using the
* device charging constraint so that the job only executes if the device is
* charging.
*
* In a normal app, it might be a good idea to include a preference for this,
* as different users may have different preferences on when you should be
* syncing your application's data.
*/
.setConstraints(Constraint.DEVICE_CHARGING)
/*
* setLifetime sets how long this job should persist. The options are to keep the
* Job "forever" or to have it die the next time the device boots up.
*/
.setLifetime(Lifetime.FOREVER)
/*
* We want these reminders to continuously happen, so we tell this Job to recur.
*/
.setRecurring(true)
/*
* We want the reminders to happen every 15 minutes or so. The first argument for
* Trigger class's static executionWindow method is the start of the time frame
* when the
* job should be performed. The second argument is the latest point in time at
* which the data should be synced. Please note that this end time is not
* guaranteed, but is more of a guideline for FirebaseJobDispatcher to go off of.
*/
.setTrigger(Trigger.executionWindow(
REMINDER_INTERVAL_SECONDS,
REMINDER_INTERVAL_SECONDS + SYNC_FLEXTIME_SECONDS))
/*
* If a Job with the tag with provided already exists, this new job will replace
* the old one.
*/
.setReplaceCurrent(true)
/* Once the Job is ready, call the builder's build method to return the Job */
.build();
/* Schedule the Job with the dispatcher */
dispatcher.schedule(constraintReminderJob);
/* The job has been initialized */
sInitialized = true;
}
}
java android android-jobscheduler firebase-job-dispatcher
java android android-jobscheduler firebase-job-dispatcher
asked Nov 19 '18 at 20:43
Rabbi hasanRabbi hasan
184
184
The class is asking for a class that extendscom.firebase.jobdispatcher.JobService
and you are providing it a class that extendsandroid.app.job.JobService
– Compass
Nov 19 '18 at 20:45
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56
add a comment |
The class is asking for a class that extendscom.firebase.jobdispatcher.JobService
and you are providing it a class that extendsandroid.app.job.JobService
– Compass
Nov 19 '18 at 20:45
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56
The class is asking for a class that extends
com.firebase.jobdispatcher.JobService
and you are providing it a class that extends android.app.job.JobService
– Compass
Nov 19 '18 at 20:45
The class is asking for a class that extends
com.firebase.jobdispatcher.JobService
and you are providing it a class that extends android.app.job.JobService
– Compass
Nov 19 '18 at 20:45
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382359%2fsetservicejava-lang-class-extends-com-firebase-jobdispatcher-jobservice-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382359%2fsetservicejava-lang-class-extends-com-firebase-jobdispatcher-jobservice-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The class is asking for a class that extends
com.firebase.jobdispatcher.JobService
and you are providing it a class that extendsandroid.app.job.JobService
– Compass
Nov 19 '18 at 20:45
Thanks for comment.I got it.
– Rabbi hasan
Nov 19 '18 at 20:56