Android: Trigger tasks with conditions with NFC

Total time: 5 Minutes

In the article Android: Automations with NFC we explained how simple tasks (e.g. turning on WLAN and turning on Bluetooth) can be triggered by an NFC tag. Of course, any task can stand here.

Now in the following article we will describe how several tasks can be executed by conditions. Conditions here are restrictions that allow tasks to be executed only on certain days of the week, days in the month, or even only on a certain date, for example. The following article explains what these conditions can be and how to create them.

1. Select and create condition

A condition is created before the actual task. We tap Add a Task and then tap Condition Block at the bottom. Here we tap Condition : Weekday and then tap the days we want. In our example, we want the task to be executed only on weekdays. So we tap on Mon, Tue, Wed, Thu and Fri. Then we tap on ✔ OK .

In the next step we tap on Add task again → Condition block and select End of condition and confirm with ✔ OK.

1. Select and create condition

2. Positioning conditions and tasks

In order to execute the tasks only when the condition is fulfilled, it must be drawn before the tasks to be executed. To do this, we tap and hold the two arrows on the right-hand side next to Condition : Weekday. Then drag the green condition in front of the corresponding tasks so that they are enclosed by the green and red condition.

2. Positioning conditions and tasks

Create individual conditions

By Add a TaskCondition block, a list of possible available conditions can be displayed. For example, you can set tasks to run only on specific days of the week, specific days in the month, or even only on a specific date. The respective fine-tuning can be set in the condition. Subsequently, step 1. and step 2. must be performed.

Create individual conditions

In this article we have described how to create multiple tasks and how to restrict them by a condition. Thus, the corresponding tasks are only executed when the condition is met, e.g. only on certain days of the year/week, or only on working days.

In another concrete application example we explain how the Android smartphone can be set to an individual "car mode" by contacting the NFC tag in the car.

Associated operating systems

« Android: Automation with NFC | Android application example: Activate "Car mode" »