CONTENT PROVIDER FOR TickTick

There’s a Content Provider access to our app since TickTick version 1.5.0. Using the Content Provider any android developer can access TickTick tasks.

How to use it

Before using Content Providers, you should read the Content Providers Develop Document.

Then, Here’s a step by step instructions of how to do this:

1. Read the introduce below, including the URL, the data columns  and more.

2. Before reading tasks, you should add this permission to the manifest.

  <uses-permission android:name="com.ticktick.task.permission.READ_TASKS" />

3. Implement your code to read tasks by our Content Provider.

Elements

There are 3 different URIs:

content://com.ticktick.task.data/tasks – Return all the tasks

content://com.ticktick.task.data/tasklist – Returns all the custom projects

Task row contains these columns:

    public static final class TaskColumns {

        public static final String ID = "ID";                                //Long

        public static final String LIST_ID = "LIST_ID";                //Long

        public static final String TITLE = "TITLE";                        //String

        public static final String DUEDATE = "DUEDATE";                //Long

        public static final String SORT_ORDER = "SORT_ORDER";                //Long

        public static final String COMPLETED = "COMPLETED";                //Long

        public static final String PRIORITY = "PRIORITY";                //Integer

        public static final String REMINDER_TIME = "REMINDER_TIME";        //Long

        public static final String REPEAT = "REPEAT_FLAG";                        //String

    }

NOTE: the fields :

SORT_ORDER(Long) - the order of task in project

COMPLETED(Long) - the completed time of task


Project row contains these columns:

    public static final class ProjectColumns {

        public static final String ID = "ID";                        //Long

        public static final String NAME = "NAME";                //String

        public static final String COLOR = "COLOR";                //String

    }

NOTE: the fields :

COLOR(String) - the color of project, I.E. #CC6600...

The “PRIORITY” columns, for a Task has values that are represented in these constants:

        public final static int Level0 = 0;// none

        public final static int Level1 = 1;// low

        public final static int Level2 = 2;

        public final static int Level3 = 3;// medium

        public final static int Level4 = 4;

        public final static int Level5 = 5;// high

Examples

URIs:

PROJECT_URI = “content://com.ticktick.task.data/tasklist”

TASKS_URI = “content://com.ticktick.task.data/tasks”

1. Fetch all projects:

ContentResolver resolver = getContentResolver();

Cursor cursor = resolver.query(PROJECT_URI, null, null,null, null);

2. Fetch all tasks:

ContentResolver resolver = getContentResolver();

Cursor cursor = resolver.query(TASKS_URI, null, null,null, null);