Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › Android file sharing

Viewing 1 post (of 1 total)
  • Author
  • #22649


    I’am developing an app in which I want to share a binary file created in the app. For sharing the file I want to use the Android Sharesheet as is recommended.

    So in my .pro file I have added QT += androidextras

    I have a .java file, public class QShareUtilspackage org.mnc.utils; , with the static method

        public static void sendFile(String filePath) {
            Intent sendIntent = new Intent();
            // We only share / send .fit files
            Uri uriToFile = Uri.fromFile(new File(filePath));
            sendIntent.putExtra(Intent.EXTRA_STREAM, uriToFile);
            Intent shareIntent = Intent.createChooser(sendIntent, "Share .fit file");
            Activity activity = new Activity();

    and in my .cpp file I call this method

    void AndroidShareUtils::sendFile(const QString &filePath, const QString &title, const QString &mimeType)
        QAndroidJniObject jsText = QAndroidJniObject::fromString(filePath);

    I get no compile errors and can install the app on my phone. I can check that the function is called but obviously nothing happens.

    Remarkeble is that in the .cpp source I get the warning: warning instantiation of function ‘QAndroidJniObject::callStaticMethod<void>’ required here, but no definition is available

    I do not know why this is showing up although this probably needs attention.

    I’am developing on W10 Qt Creator 4.10.2 and use kit Android for arm64-v8a(Clang Qt 5.13.2 …)

    I searched for hours but have no clou as what to try next. If anyone has any ideas I would appreciate your suggestion(s).


Viewing 1 post (of 1 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded