Java tutorial
/* * SmartFoodMenu - Android application for canteens extendable with plugins * * Copyright 2016-2018 Martin Mare <mmrmartin[at]gmail[dot]com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ package cz.maresmar.sfm.plugin; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.support.v4.app.JobIntentService; /** * {@link BroadcastReceiver} that allows planing of {@link JobIntentService} from another process */ public class RunPlanReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (ActionContract.BROADCAST_PLAN_RUN.equals(intent.getAction())) { int jobId = intent.getIntExtra(ActionContract.EXTRA_JOB_ID, 0); Intent intentToPlan = intent.getParcelableExtra(ActionContract.EXTRA_INTENT_TO_DO); ComponentName componentName = intentToPlan.getComponent(); JobIntentService.enqueueWork(context, componentName, jobId, intentToPlan); } } }