Search code examples
androidqtparse-platformback4appqtandroidextras

How to connect to parse server backend from back4app.com for Qt android app


I am trying to develop an Android application with Qt 5.13. I am planning to use a parse-server for my backend. I am using a free plan from back4app. I followed the official tutorial here

But I am not sure how to import the android SDK into my Qt C++ code. ?

I added the below code to the gradle.build file.

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
    implementation "com.github.parse-community.Parse-SDK-Android:parse:1.20.0"
}

repositories{
  mavenCentral()
  jcenter()
  maven { url 'https://jitpack.io' }
}

After this step, I am not sure where to put below code

import com.parse.Parse;

I need to be able to run the below code in my C++ code.

Parse.initialize(new Parse.Configuration.Builder(this)
      .applicationId("appId")
      .clientKey("clientId")
      .server("https://parseapi.back4app.com")
      .build()

I tried to import in Qml code without luck.


Solution

  • Based on the documentation you need to put the code into a .java file. For that I'd suggest to check the guide on QAndroidJniObject Class, as you'll need to do your base implementation in java and using java native interface JNI to call the code from C++.

    Since you'll be needing https to access the server. You will also need to include openSSL libs to your project, you can find the required libs and instructions here