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


Java GooglePlayDriver类代码示例

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


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

示例1: init

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
public void init (FirebaseApp firebaseApp) {
	mFirebaseApp = firebaseApp;
	String token = getFirebaseMessagingToken();

	dispatcher =
	new FirebaseJobDispatcher(new GooglePlayDriver(activity.getApplicationContext()));
	dispatcher.cancel("firebase-notify-in-time-UID");

	Utils.d("Firebase Cloud messaging token: " + token);

	// Perform task here..!
	if (KeyValueStorage.getValue("notification_complete_task") != "0") {
		try {
			JSONObject obj =
			new JSONObject(KeyValueStorage.getValue("notification_task_data"));

			Dictionary data = new Dictionary();
			Iterator<String> iterator = obj.keys();

			while (iterator.hasNext()) {
				String key = iterator.next();
				Object value = obj.opt(key);

				if (value != null) {
					data.put(key, value);
				}
			}

			Utils.callScriptCallback(
			KeyValueStorage.getValue("notification_complete_task"),
			"Notification", "TaskComplete", data);

		} catch (JSONException e) {

		}

		KeyValueStorage.setValue("notification_complete_task", "0");
	}
}
 
开发者ID:FrogSquare,项目名称:GodotFireBase,代码行数:40,代码来源:Notification.java

示例2: setupCinemaListUpdates

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
private void setupCinemaListUpdates() {
    long lastUpdated = getSharedPreferences("settings", MODE_PRIVATE).getLong("cinemasUpdated", -1);
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));

    if(lastUpdated < (System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7))) {
        // It's been more than a week since the last update, so setup/reset job because it should have run by now
        Job updateJob = dispatcher.newJobBuilder()
                .setService(CinemaUpdateJob.class)
                .setTag("cinemasListUpdate")
                .setRecurring(true)
                .setLifetime(Lifetime.FOREVER)
                .setTrigger(Trigger.executionWindow(0, (int) TimeUnit.DAYS.toSeconds(7)))
                .setReplaceCurrent(true)
                .build();
        dispatcher.mustSchedule(updateJob);
    }

    // Also run immediately if the list has never been updated
    if(lastUpdated == -1) {
        dispatcher.mustSchedule(CinemaUpdateJob.getJobToUpdateImmediately(dispatcher));
    }
}
 
开发者ID:jpelgrom,项目名称:Movie-Notifier-Android,代码行数:23,代码来源:MovieNotifierApp.java

示例3: syncImmediately

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
synchronized public static void syncImmediately(Context context, String tag) {
    Timber.d("Scheduling a immediate sync");

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

    Bundle bundle = new Bundle();
    Job myJob = dispatcher.newJobBuilder()
            .setService(QuoteJobService.class)
            .setTag(tag)
            .setExtras(bundle)
            .setRecurring(false)
            .setTrigger(Trigger.executionWindow(0, 0))
            .setLifetime(Lifetime.UNTIL_NEXT_BOOT)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .setReplaceCurrent(true)
            .build();

    dispatcher.mustSchedule(myJob);

}
 
开发者ID:henriquenfaria,项目名称:stock-hawk,代码行数:23,代码来源:QuoteSyncJob.java

示例4: onSetupComplete

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
@SuppressLint("ApplySharedPref")
private void onSetupComplete() {
    //download whole leaderboards data asynchronously
    new FetchLeaderBoardDataAsync(this).execute();

    //schedule daily sync at 3:00 am local time
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));

    DateTime now = new DateTime();
    DateTime tomorrow = now.plusDays(1).withTimeAtStartOfDay().plusHours(3);
    int windowStart = Hours.hoursBetween(now, tomorrow).getHours() * 60 * 60;
    Job synJob = dispatcher.newJobBuilder()
            .setService(SyncScheduler.class)
            .setTag(Constants.PERIODIC_SYNC_SCHEDULE_KEY)
            .setReplaceCurrent(true)
            .setTrigger(Trigger.executionWindow(windowStart, windowStart + 10))
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
            .build();
    dispatcher.mustSchedule(synJob);

    sharedPreferences.edit().putBoolean(Constants.PREF_FIREBASE_SETUP, true).commit();
    startActivity(new Intent(this, PreChecksActivity.class));
    finish();
}
 
开发者ID:Protino,项目名称:CodeWatch,代码行数:26,代码来源:OnBoardActivity.java

示例5: sendSyncObjects

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
@WorkerThread
public static boolean sendSyncObjects(Context context, LinkedHashSet<SyncParam> syncParams) {
    if(!NetworkUtil.isConnected(context)){
        scheduleJob(context, SEND_SYNC_TAG);
        return false;
    }

    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
    dispatcher.cancel(SEND_SYNC_TAG);

    if(syncParams == null){
        Log.e("SyncService", "erro ao enviar syncParamns: null");
        return false;
    }

    boolean result = true;
    for(SyncParam syncParam : syncParams){
        boolean sent = sendSyncObj(syncParam);
        if(result) result = sent;
    }

    return result;
}
 
开发者ID:alexandregpereira,项目名称:goblin-lib,代码行数:24,代码来源:SyncServerHelper.java

示例6: scheduleFirebaseJobDispatcherSync

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
static void scheduleFirebaseJobDispatcherSync(@NonNull final Context context) {

        Driver driver = new GooglePlayDriver(context);
        FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(driver);

        /* Create the Job to periodically sync Sunshine */
        Job syncSunshineJob = dispatcher.newJobBuilder()
                .setService(NewsFirebaseJobService.class)
                .setTag(NEWS_SYNC_TAG)
                .setConstraints(Constraint.ON_ANY_NETWORK)
                .setLifetime(Lifetime.FOREVER)
                .setRecurring(true)
                .setTrigger(Trigger.executionWindow(
                        REMINDER_INTERVAL_SECONDS,
                        REMINDER_INTERVAL_SECONDS + SYNC_FLEXTIME_SECONDS))
                .setReplaceCurrent(true)
                .build();

        dispatcher.schedule(syncSunshineJob);
    }
 
开发者ID:vikasdesale,项目名称:News24x7-news-from-every-part-of-the-world,代码行数:21,代码来源:NewsSyncUtils.java

示例7: scheduleJob

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
public static void scheduleJob(Context context, Message message) {

        try {
            Bundle bundle = new Bundle();
            FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
            bundle.putString(MobiComKitConstants.AL_MESSAGE_KEY, message.getKeyString());
            Class pushNotificationJobServiceClass = Class.forName("com.applozic.mobicomkit.uiwidgets.notification.PushNotificationJobService");
            Job myJob = dispatcher.newJobBuilder()
                    .setService(pushNotificationJobServiceClass) // the JobService that will be called
                    .setTag(MobiComKitConstants.PUSH_NOTIFICATION_DISPATCHER)  // uniquely identifies the job
                    .setRecurring(false)
                    .setTrigger(Trigger.executionWindow(0, 0))
                    .setReplaceCurrent(true)
                    .setRetryStrategy(RetryStrategy.DEFAULT_LINEAR)
                    .setConstraints(Constraint.ON_ANY_NETWORK)
                    .setExtras(bundle)
                    .build();
            dispatcher.mustSchedule(myJob);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
开发者ID:AppLozic,项目名称:Applozic-Android-Chat-Sample,代码行数:23,代码来源:PushNotificationDispatcher.java

示例8: onStartJob

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的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

示例9: startRest

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
void startRest(final Context context) {

        new ResetRoutes(new OnFinish() {
            @Override
            public void finished() {
                resetDone.postValue(true);
                FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
                Job myJob = dispatcher.newJobBuilder()
                        .setService(SyncJobs.class)
                        .setReplaceCurrent(true)
                        .setTrigger(Trigger.executionWindow(0, 1))
                        .setTag(SyncJobs.SINGLE_ROUTE_SYNC)
                        .build();
                dispatcher.mustSchedule(myJob);
            }

            @Override
            public void allRoutes(List<RouteData> routeDataList) {

            }
        }).execute(context);

    }
 
开发者ID:NCBSinfo,项目名称:NCBSinfo,代码行数:24,代码来源:SettingsViewModel.java

示例10: setup

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
private static void setup(@NonNull final Context context, final int timeInSeconds) {
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));

    Job myJob = dispatcher.newJobBuilder()
            // the JobService that will be called
            .setService(DailyReminderService.class)
            // uniquely identifies the job
            .setTag(DailyReminderService.TAG)
            // one-off job
            .setRecurring(false)
            // persist past a device reboot (requires boot receiver permission)
            .setLifetime(Lifetime.FOREVER)
            // start between 0 and 60 seconds from now
            .setTrigger(Trigger.executionWindow(timeInSeconds, timeInSeconds + 30))
            // overwrite an existing job with the same tag
            .setReplaceCurrent(true)
            // retry with exponential backoff
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            //.setExtras(myExtrasBundle)
            .build();

    dispatcher.mustSchedule(myJob);
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:24,代码来源:DailyReminderServiceHelper.java

示例11: schedulePeriodic

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
public static void schedulePeriodic(Context context, String tag, int period) {
    Timber.d("Scheduling a periodic sync every " + period + " seconds");

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

    Job myJob = dispatcher.newJobBuilder()
            .setService(QuoteJobService.class)
            .setTag(tag)
            .setRecurring(true)
            .setTrigger(Trigger.executionWindow(period, period))
            .setLifetime(Lifetime.UNTIL_NEXT_BOOT)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .setRetryStrategy(RetryStrategy.DEFAULT_EXPONENTIAL)
            .setReplaceCurrent(true)
            .build();

    dispatcher.mustSchedule(myJob);
}
 
开发者ID:henriquenfaria,项目名称:stock-hawk,代码行数:19,代码来源:QuoteSyncJob.java

示例12: startSignInSocial

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
public static void startSignInSocial(Context context, Bundle bundle){
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));

    Job myJob = dispatcher.newJobBuilder()
            // the JobService that will be called
            .setService(SessionJobService.class)
            // uniquely identifies the job
            .setTag(SIGN_IN_SOCIAL_ACTION)
            // one-off job
            .setRecurring(false)
            // start between 0 and 60 seconds from now
            .setTrigger(Trigger.executionWindow(0, 60))
            // don't overwrite an existing job with the same tag
            .setReplaceCurrent(false)
            // constraints that need to be satisfied for the job to run
            .setConstraints(
                    // only run on an unmetered network
                    Constraint.ON_UNMETERED_NETWORK
            )
            .setExtras(bundle)
            .build();

    dispatcher.mustSchedule(myJob);
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:25,代码来源:SessionJobService.java

示例13: onStartJob

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的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: onClickLogOut

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
@OnClick(R.id.logout)
public void onClickLogOut() {
    AuthUI.getInstance()
            .signOut(getActivity())
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                public void onComplete(@NonNull Task<Void> task) {
                    startActivity(new Intent(getContext(), LoginActivity.class));
                    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(getContext()));
                    dispatcher.cancelAll();
                    Uri uri = TaskItemsContract.TaskItemsColumns.CONTENT_URI;
                    getActivity().getContentResolver().delete(uri, null, null);
                    getActivity().finish();
                }
            });
}
 
开发者ID:vixir,项目名称:Perfect-Day,代码行数:16,代码来源:MoreInfoFragment.java

示例15: scheduleUpdateProgressReminder

import com.firebase.jobdispatcher.GooglePlayDriver; //导入依赖的package包/类
synchronized public static void scheduleUpdateProgressReminder(@NonNull final Context context) {
    if (sInitialized) {
        return;
    }
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(System.currentTimeMillis());
    calendar.set(Calendar.HOUR_OF_DAY, 23);
    calendar.set(Calendar.MINUTE, 59);
    calendar.set(Calendar.SECOND, 59);
    calendar.add(Calendar.MINUTE, 3);
    //could have done add(Calender.Date,1). I have trust issues
    Intent intentAlarm = new Intent(context, UpdateDayAlarmReciever.class);
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, PendingIntent.getBroadcast(context, 1, intentAlarm, PendingIntent.FLAG_CANCEL_CURRENT));

    Driver driver = new GooglePlayDriver(context);
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(driver);

    Job constraintReminderJob = dispatcher.newJobBuilder()
            .setService(UpdateProgressFirebaseJobService.class)
            .setTag(UPDATE_PROGRESS_JOB_TAG)
            .setLifetime(Lifetime.FOREVER)
            .setRecurring(true)
            .setTrigger(Trigger.executionWindow(
                    0,
                    UPDATE_INTERVAL_SECONDS))
            .setReplaceCurrent(true)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .build();
    /* Schedule the Job with the dispatcher */
    dispatcher.schedule(constraintReminderJob);
    /* The job has been initialized */
    sInitialized = true;
}
 
开发者ID:vixir,项目名称:Perfect-Day,代码行数:35,代码来源:UpdateProgressUtilities.java


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