当前位置: 首页>>代码示例>>Java>>正文


Java JobParameters类代码示例

本文整理汇总了Java中com.firebase.jobdispatcher.JobParameters的典型用法代码示例。如果您正苦于以下问题:Java JobParameters类的具体用法?Java JobParameters怎么用?Java JobParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JobParameters类属于com.firebase.jobdispatcher包,在下文中一共展示了JobParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
/**
 * 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) {

    mFetchWeatherTask = new AsyncTask<Void, Void, Void>(){
        @Override
        protected Void doInBackground(Void... voids) {
            Context context = getApplicationContext();
            SunshineSyncTask.syncWeather(context);
            jobFinished(jobParameters, false);
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            jobFinished(jobParameters, false);
        }
    };

    mFetchWeatherTask.execute();
    return true;
}
 
开发者ID:rashikaranpuria,项目名称:ubiquitous,代码行数:32,代码来源:SunshineFirebaseJobService.java

示例2: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(final JobParameters params) {
    REDApplication.get(getApplicationContext()).getComponent().dataManager().
            loadIndex().observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(new DisposableSingleObserver<Index>() {
                @Override
                public void onSuccess(Index index) {
                    if (index.response.notifications != null){
                        checkNotifications(index);
                    }
                    jobFinished(params, false);
                }

                @Override
                public void onError(Throwable error) {
                    jobFinished(params, false);
                }
            });

    return true;
}
 
开发者ID:stuxo,项目名称:REDAndroid,代码行数:23,代码来源:NotificationService.java

示例3: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(final JobParameters jobParameters) {

    mFetchWeatherTask = new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... voids) {
            Context context = getApplicationContext();
            SunshineSyncTask.syncWeather(context);
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            //  COMPLETED (6) Once the weather data is sync'd, call jobFinished with the appropriate arguements
            jobFinished(jobParameters, false);
        }
    };

    mFetchWeatherTask.execute();
    return true;
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:22,代码来源:SunshineFirebaseJobService.java

示例4: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(final JobParameters jobParameters) {

    mNewsFetchTask = new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... voids) {
            Context context = getApplicationContext();
            NewsSyncTask.syncNews(context);
            jobFinished(jobParameters, false);
            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            jobFinished(jobParameters, false);
        }
    };

    mNewsFetchTask.execute();
    return true;
}
 
开发者ID:vikasdesale,项目名称:News24x7-news-from-every-part-of-the-world,代码行数:22,代码来源:NewsFirebaseJobService.java

示例5: getView

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
  final Context ctx = getContext();

  TextView textView = new TextView(parent.getContext());
  JobParameters job = getItem(position).job;
  List<Uri> uris =
      job.getTriggerReason() != null
          ? job.getTriggerReason().getTriggeredContentUris()
          : Collections.<Uri>emptyList();
  textView.setText(String.format(Locale.US, CELL_FORMAT, job.getTag(), job.getService(), uris));

  textView.setOnClickListener(
      new View.OnClickListener() {
        @Override
        public void onClick(View v) {
          Intent i = new Intent(ctx, JobDetailActivity.class);
          i.putExtra("pos", position);
          ctx.startActivity(i);
        }
      });

  return textView;
}
 
开发者ID:firebase,项目名称:firebase-jobdispatcher-android,代码行数:25,代码来源:JobStoreAdapter.java

示例6: onCreate

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  final Bundle extras = getIntent().getExtras();
  if (extras == null) {
    throw new IllegalArgumentException("Expected Bundle of extras, got null");
  }
  int pos = extras.getInt("pos", -1);
  if (pos == -1) {
    throw new IllegalArgumentException("Expected pos to be present, was absent");
  }

  final JobParameters job = CentralContainer.getStore(getApplicationContext()).get(pos).job;
  if (job == null) {
    throw new IllegalArgumentException("Expected pos to represent a Job");
  }

  getSupportActionBar().setTitle(job.getTag());
  setContentView(createViewForJob(job));
}
 
开发者ID:firebase,项目名称:firebase-jobdispatcher-android,代码行数:22,代码来源:JobDetailActivity.java

示例7: schedule

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public int schedule(@NonNull Job job) {
  Log.i("TrackingBackend", "beginning schedule loop");

  synchronized (mStore) {
    final Iterator<JobHistory> it = mStore.iterator();
    while (it.hasNext()) {
      JobParameters j = it.next().job;

      if (j.getTag().equals(job.getTag()) && j.getService().equals(job.getService())) {
        it.remove();
      }
    }

    mStore.add(new JobHistory(job));
  }

  Log.i("TrackingBackend", "ending schedule loop");

  return mDriver.schedule(job);
}
 
开发者ID:firebase,项目名称:firebase-jobdispatcher-android,代码行数:22,代码来源:CentralContainer.java

示例8: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(final JobParameters params) {
    Bundle bundle = params.getExtras();
    try {
        String messageKey = bundle.getString(MobiComKitConstants.AL_MESSAGE_KEY);
        if (!TextUtils.isEmpty(messageKey)) {
            Intent notificationIntentService = new Intent(PushNotificationJobService.this, NotificationIntentService.class);
            notificationIntentService.setAction(NotificationIntentService.ACTION_AL_NOTIFICATION);
            notificationIntentService.putExtra(MobiComKitConstants.AL_MESSAGE_KEY, messageKey);
            NotificationIntentService.enqueueWork(PushNotificationJobService.this, notificationIntentService);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    jobFinished(params, false);
    return false;
}
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:18,代码来源:PushNotificationJobService.java

示例9: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters params) {
    Log.inform("Sync Job request received");
    dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(getBaseContext()));
    switch (params.getTag()) {
        case RESET_ALL_JOBS:
            resetAllJobs();
            break;
        case SYNC_PREFERENCES:
            syncPreferences();
            break;
        case SYNC_ROUTE_DATA:
            syncRouteData();
            break;
        case SINGLE_ROUTE_SYNC:
            syncRouteData();
            break;
    }
    return false;
}
 
开发者ID:NCBSinfo,项目名称:NCBSinfo,代码行数:21,代码来源:SyncJobs.java

示例10: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(final JobParameters parameters) {
    new Thread(new Runnable() {
        @Override
        public void run() {
            switch(parameters.getTag()) {
                case BackendUtils.JOB_SYNC_DATA:
                    jobFinished(parameters, !syncData());
                    break;
                case BackendUtils.JOB_SYNC_PHOTOS:
                    jobFinished(parameters, !syncPhotos());
                    break;
                default:
                    jobFinished(parameters, false);
            }
        }
    }).start();
    return true;
}
 
开发者ID:ultramega,项目名称:flavordex,代码行数:20,代码来源:SyncService.java

示例11: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters jobParameters) {
    // Do some work here
    Log.i(TAG, "onStartJob " + jobParameters.getTag());

    if (SIGN_IN_SOCIAL_ACTION.equals(jobParameters.getTag())) {
        Bundle jobExtras = jobParameters.getExtras();
        ServiceManager.getInstance().login(QBProvider.FIREBASE_PHONE,
                jobExtras.getString(FirebaseAuthHelper.EXTRA_FIREBASE_ACCESS_TOKEN),
                App.getInstance().getAppSharedHelper().getFirebaseProjectId())
                .subscribe( new JobObserver(this, jobParameters));
        return true;
    }

    return false; // Answers the question: "Is there still work going on?"*/
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:17,代码来源:SessionJobService.java

示例12: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters job) {
	// Do some work here
	Utils.d("Job Started.");

	Bundle bundle = job.getExtras();
	Utils.d("Message: " + bundle.getString("message"));

	MessagingService.sendNotification(bundle, this);

	return true; // Answers the question: "Is there still work going on?"
}
 
开发者ID:FrogSquare,项目名称:GodotFireBase,代码行数:13,代码来源:NotifyInTime.java

示例13: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters job) {

    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));

    /* Schedule the job once now*/
    Job oneTimeJob = dispatcher.newJobBuilder()
            .setService(WakatimeDataSyncJob.class)
            .setTag("OneTimeJob")
            .setTrigger(Trigger.executionWindow(0, 60))
            .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
            .build();
    dispatcher.mustSchedule(oneTimeJob);

    /* Schedule a recurring job everyday */
    Job synJob = dispatcher.newJobBuilder()
            .setService(WakatimeDataSyncJob.class)
            .setTag(Constants.WAKATIME_DATA_SYNC_JOB_TAG)
            .setReplaceCurrent(true)
            .setRecurring(true)
            .setTrigger(Trigger.executionWindow(Constants.SYNC_PERIOD, Constants.SYNC_TOLERANCE))
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
            .build();
    dispatcher.mustSchedule(synJob);
    return false;
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:28,代码来源:SyncScheduler.java

示例14: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters job) {
    //check whether logged in or not, also check network connectivity
    if (!CacheUtils.isLoggedIn(getApplicationContext())) {
        return false;
    }
    new MainThread(job).start();
    return true;
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:10,代码来源:WakatimeDataSyncJob.java

示例15: onStartJob

import com.firebase.jobdispatcher.JobParameters; //导入依赖的package包/类
@Override
public boolean onStartJob(JobParameters job) {
    switch (job.getTag()){
        case SyncServerHelper.SEND_SYNC_TAG:
            SyncServerService.startSendSyncObj(this);
            break;
        case SyncServerHelper.SYNC_TAG:
            SyncServerService.startSync(this);
    }
    return false;
}
 
开发者ID:alexandregpereira,项目名称:goblin-lib,代码行数:12,代码来源:SyncJobService.java


注:本文中的com.firebase.jobdispatcher.JobParameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。