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


Java FirebaseJobDispatcher.cancel方法代码示例

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


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

示例1: init

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的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: sendSyncObjects

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

示例3: scheduleJob

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的package包/类
static void scheduleJob(Context context, String tag) {
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
    dispatcher.cancel(tag);

    Job myJob = dispatcher.newJobBuilder()
            .setService(SyncJobService.class) // the JobService that will be called
            .setTag(tag)        // uniquely identifies the job
            .setRecurring(false)
            .setLifetime(Lifetime.FOREVER)
            .setTrigger(Trigger.NOW)
            .setConstraints(Constraint.ON_ANY_NETWORK)
            .build();

    dispatcher.mustSchedule(myJob);
}
 
开发者ID:alexandregpereira,项目名称:goblin-lib,代码行数:16,代码来源:SyncServerHelper.java

示例4: cancel

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的package包/类
public static void cancel(@NonNull final Context context) {
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
    dispatcher.cancel(DailyReminderService.TAG);
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:5,代码来源:DailyReminderServiceHelper.java

示例5: cancel

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的package包/类
public static boolean cancel(@NonNull final Context context) {
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(context));
    return dispatcher.cancel(DailyReminderService.TAG) == FirebaseJobDispatcher.CANCEL_RESULT_SUCCESS;
}
 
开发者ID:canyapan,项目名称:DietDiaryApp,代码行数:5,代码来源:DriveBackupServiceHelper.java

示例6: stopSyncJob

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的package包/类
synchronized public static void stopSyncJob(final Context context, String tag) {
    FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver
            (context));
    dispatcher.cancel(tag);
}
 
开发者ID:henriquenfaria,项目名称:stock-hawk,代码行数:6,代码来源:QuoteSyncJob.java

示例7: onStartCommand

import com.firebase.jobdispatcher.FirebaseJobDispatcher; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    Timber.d("onStartCommand");
    if (intent == null) {
        stopSelf();
        return START_NOT_STICKY;
    }
    Bundle extras = intent.getExtras();
    if (extras == null) {
        stopSelf();
        return START_NOT_STICKY;
    }
    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
    String action = intent.getAction();
    int notificationId = extras.getInt(C.EXTRA.NOTIFICATION_ID);
    int rowId = extras.getInt(C.EXTRA.ROW);
    int widgetId = extras.getInt(C.EXTRA.WIDGET_UPDATE);
    if (action != null && action.equals(C.ACTION.CANCEL)) {
        FirebaseJobDispatcher dispatcher = new FirebaseJobDispatcher(new GooglePlayDriver(this));
        dispatcher.cancel(String.format(Locale.ENGLISH, "eta-notification-%d", notificationId));
        notificationManager.cancel(notificationId);
        routeStops.delete(notificationId);
        if (routeStops.size() < 1) {
            stopSelf();
        }
        return START_NOT_STICKY;
    }

    BusRouteStop busRouteStop = extras.getParcelable(C.EXTRA.STOP_OBJECT);
    if (busRouteStop != null) {
        notificationId = NotificationUtil.getNotificationId(busRouteStop);
        NotificationCompat.Builder builder = NotificationUtil.showArrivalTime(this, busRouteStop);
        notificationManager.notify(notificationId, builder.build());
        routeStops.put(notificationId, busRouteStop);
        Intent startIntent = new Intent(getApplicationContext(), EtaService.class);
        startIntent.putExtra(C.EXTRA.STOP_OBJECT, busRouteStop);
        startIntent.putExtra(C.EXTRA.NOTIFICATION_ID, notificationId);
        startIntent.putExtra(C.EXTRA.ROW, rowId);
        startIntent.putExtra(C.EXTRA.WIDGET_UPDATE, widgetId);
        startService(startIntent);
    }
    return START_STICKY;
}
 
开发者ID:alvinhkh,项目名称:buseta,代码行数:44,代码来源:NotificationService.java


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