Search code examples
androidc++qtcalendarqandroidjniobject

Accessing Android Calendar Provider from QT / C++ Project


Preferable way would be using Android Calendar Provider (http://developer.android.com/guide/topics/providers/calendar-provider.html). But this API is Java only.

I didnt found anything for the Android NDK Api to access Android Calendar.

Also QT 5 mobile api only lets you access Sensor / Location / Bluetooth and NFC data (http://doc.qt.io/qt-5/mobiledevelopment.html).

Is there any way to query the Android phone calendar from a C++ / QT project?

Edit: I need future appointments the user has in his calendar


Solution

  • You need to use QAndroidJniObject, it makes it possible to create and use Android native SDK objects from a C++/Qt application.

    If you have a working java code accessing the calendaryou can try to transcode it using QAndroidJniObject.

    Here is an example: open android settings from QT app(com.android.settings)

    Note : If the java code is too complex, you can also include a java file in your C++/Qt project and create an object from this java file using QAndroidJniObject. It may be easier than transcoding the whole code.